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

测试列表,测试提交,实践课详情,体验课详情,预约接口,点赞接口,学习进度记录,学习完成,预约查询,取消预约

huan.wang@yueguanjia.com 5 лет назад
Родитель
Сommit
b7f23dfda4
44 измененных файлов с 1344 добавлено и 269 удалено
  1. 59 0
      src/main/java/com/ygj/yuemum/controller/college/CollegeBookingController.java
  2. 17 1
      src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumCoreController.java
  3. 12 0
      src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumExperienceController.java
  4. 12 0
      src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumPracticeController.java
  5. 14 1
      src/main/java/com/ygj/yuemum/controller/college/CollegeTestController.java
  6. 11 3
      src/main/java/com/ygj/yuemum/controller/college/CollegeTestDetailController.java
  7. 25 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeBookingDao.java
  8. 4 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumCoreDao.java
  9. 8 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumExperienceDao.java
  10. 4 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumPracticeDao.java
  11. 7 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeLearningDetailDao.java
  12. 3 1
      src/main/java/com/ygj/yuemum/dao/college/CollegeTestDao.java
  13. 7 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeTestDetailDao.java
  14. 2 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeTestResultDao.java
  15. 3 1
      src/main/java/com/ygj/yuemum/dao/college/CollegeUserPointsDao.java
  16. 85 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeBooking.java
  17. 8 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumCore.java
  18. 36 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumExperience.java
  19. 35 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumPractice.java
  20. 3 3
      src/main/java/com/ygj/yuemum/domain/college/CollegeLearningDetail.java
  21. 31 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeQuery.java
  22. 47 9
      src/main/java/com/ygj/yuemum/domain/college/CollegeTest.java
  23. 14 5
      src/main/java/com/ygj/yuemum/domain/college/CollegeTestDetail.java
  24. 3 12
      src/main/java/com/ygj/yuemum/domain/college/CollegeTestResult.java
  25. 21 3
      src/main/java/com/ygj/yuemum/domain/college/ReturnUserLearningCoreDetail.java
  26. 70 0
      src/main/java/com/ygj/yuemum/service/college/CollegeBookingService.java
  27. 145 44
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumCoreService.java
  28. 19 0
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumExperienceService.java
  29. 34 5
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumPracticeService.java
  30. 11 0
      src/main/java/com/ygj/yuemum/service/college/CollegeLearningDetailService.java
  31. 62 1
      src/main/java/com/ygj/yuemum/service/college/CollegeTestDetailService.java
  32. 5 0
      src/main/java/com/ygj/yuemum/service/college/CollegeTestResultService.java
  33. 55 3
      src/main/java/com/ygj/yuemum/service/college/CollegeTestService.java
  34. 120 109
      src/main/java/com/ygj/yuemum/service/college/CollegeUserPointsService.java
  35. 10 0
      src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java
  36. 143 0
      src/main/resources/mybatis/mapper/college/CollegeBookingMapper.xml
  37. 21 5
      src/main/resources/mybatis/mapper/college/CollegeCurriculumCoreMapper.xml
  38. 31 8
      src/main/resources/mybatis/mapper/college/CollegeCurriculumExperienceMapper.xml
  39. 34 10
      src/main/resources/mybatis/mapper/college/CollegeCurriculumPracticeMapper.xml
  40. 30 3
      src/main/resources/mybatis/mapper/college/CollegeLearningDetailMapper.xml
  41. 38 10
      src/main/resources/mybatis/mapper/college/CollegeTestDetailMapper.xml
  42. 22 13
      src/main/resources/mybatis/mapper/college/CollegeTestMapper.xml
  43. 16 18
      src/main/resources/mybatis/mapper/college/CollegeTestResultMapper.xml
  44. 7 1
      src/main/resources/mybatis/mapper/college/CollegeUserPointsMapper.xml

+ 59 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeBookingController.java

@@ -0,0 +1,59 @@
+package com.ygj.yuemum.controller.college;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ygj.yuemum.domain.college.CollegeBooking;
+import com.ygj.yuemum.service.college.CollegeBookingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@RestController
+public class CollegeBookingController {
+
+    @Autowired
+    private CollegeBookingService collegeBookingService;
+
+    @GetMapping("/getCollegeBookings")
+    public List<CollegeBooking> getCollegeBookings() {
+        return collegeBookingService.getCollegeBookings();
+    }
+
+    @PostMapping("/college/getCollegeBooking")
+    public String getCollegeBooking(@RequestParam("id") Integer id) {
+        String jso = JSONObject.toJSONString(collegeBookingService.getCollegeBooking(id), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+    @PostMapping("/college/addCollegeBooking")
+    public int addCollegeBooking(@ModelAttribute CollegeBooking collegeBooking) {
+        return collegeBookingService.addCollegeBooking(collegeBooking);
+    }
+
+    @GetMapping("/deleteCollegeBooking")
+    public int deleteCollegeBooking(@RequestParam("id") Integer id) {
+        return collegeBookingService.deleteCollegeBooking(id);
+    }
+
+    @PostMapping("/updateCollegeBooking")
+    public int updateCollegeBooking(@ModelAttribute CollegeBooking collegeBooking) {
+        return collegeBookingService.updateCollegeBooking(collegeBooking);
+    }
+
+    @PostMapping("/college/bookingCancel")
+    public int bookingCancel(@RequestParam("openid") String openid,@RequestParam("phone") String phone,@RequestParam("college_code") String college_code) {
+        CollegeBooking collegeBooking = new CollegeBooking();
+        collegeBooking.setOpenid(openid);
+        collegeBooking.setPhone(phone);
+        collegeBooking.setCollege_code(college_code);
+        return collegeBookingService.bookingCancel(collegeBooking);
+    }
+
+
+
+
+
+}

+ 17 - 1
src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumCoreController.java

@@ -52,7 +52,7 @@ public class CollegeCurriculumCoreController {
 
 
     @PostMapping("/college/queryCoreDetail")
-    public String queryCoreDetail(@RequestParam("openid") String openid,@RequestParam("id") Integer id) {
+    public String queryCoreDetail(@RequestParam("openid") String openid,@RequestParam("collegeId") Integer id) {
         LinkedHashMap<String, Object> orderTemps = collegeCurriculumCoreService.queryCoreDetail(openid,id);
         String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
         return jso;
@@ -69,4 +69,20 @@ public class CollegeCurriculumCoreController {
         return jso;
     }
 
+    @PostMapping("/college/corePositive")
+    public int corePositive(@RequestParam("openid") String openid,@RequestParam("c_code") String c_code) {
+        return collegeCurriculumCoreService.corePositive(openid,c_code);
+    }
+
+    @PostMapping("/college/coreLearningFinish")
+    public int coreLearningFinish(@RequestParam("openid") String openid,@RequestParam("c_code") String c_code) {
+        return collegeCurriculumCoreService.coreLearningFinish(openid,c_code);
+    }
+
+    @PostMapping("/college/coreLearningUpdate")
+    public int coreLearningUpdate(@RequestParam("openid") String openid,@RequestParam("c_code") String c_code,@RequestParam("rate") Float rate) {
+        return collegeCurriculumCoreService.coreLearningUpdate(openid,c_code,rate);
+    }
+
+
 }

+ 12 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumExperienceController.java

@@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.ygj.yuemum.domain.college.CollegeCurriculumCore;
 import com.ygj.yuemum.domain.college.CollegeCurriculumExperience;
+import com.ygj.yuemum.domain.college.CollegeQuery;
 import com.ygj.yuemum.service.college.CollegeCurriculumCoreService;
 import com.ygj.yuemum.service.college.CollegeCurriculumExperienceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.ParseException;
 import java.util.LinkedHashMap;
 import java.util.List;
 
@@ -51,5 +53,15 @@ public class CollegeCurriculumExperienceController {
         return jso;
     }
 
+    @PostMapping("/college/queryExperienceDetail")
+    public String queryExperienceDetail(@RequestParam("phone") String phone,@RequestParam("openid") String openid,@RequestParam("c_code") String c_code) throws ParseException {
+        CollegeQuery collegePracticeQuery = new CollegeQuery();
+        collegePracticeQuery.setPhone(phone);
+        collegePracticeQuery.setOpenid(openid);
+        collegePracticeQuery.setC_code(c_code);
+        String jso = JSONObject.toJSONString(collegeCurriculumExperienceService.queryExperienceDetail(collegePracticeQuery), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
 
 }

+ 12 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumPracticeController.java

@@ -4,10 +4,12 @@ package com.ygj.yuemum.controller.college;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.ygj.yuemum.domain.college.CollegeCurriculumPractice;
+import com.ygj.yuemum.domain.college.CollegeQuery;
 import com.ygj.yuemum.service.college.CollegeCurriculumPracticeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.ParseException;
 import java.util.LinkedHashMap;
 import java.util.List;
 
@@ -50,5 +52,15 @@ public class CollegeCurriculumPracticeController {
         return jso;
     }
 
+    @PostMapping("/college/queryPracticeDetail")
+    public String queryPracticeDetail(@RequestParam("phone") String phone,@RequestParam("openid") String openid,@RequestParam("c_code") String c_code) throws ParseException {
+        CollegeQuery collegePracticeQuery = new CollegeQuery();
+        collegePracticeQuery.setPhone(phone);
+        collegePracticeQuery.setOpenid(openid);
+        collegePracticeQuery.setC_code(c_code);
+        String jso = JSONObject.toJSONString(collegeCurriculumPracticeService.queryPracticeDetail(collegePracticeQuery), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
 
 }

+ 14 - 1
src/main/java/com/ygj/yuemum/controller/college/CollegeTestController.java

@@ -1,11 +1,14 @@
 package com.ygj.yuemum.controller.college;
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.ygj.yuemum.domain.college.CollegeTest;
 import com.ygj.yuemum.service.college.CollegeTestService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 
 @RestController
@@ -20,7 +23,7 @@ public class CollegeTestController {
     }
 
     @GetMapping("/getCollegeTest")
-    public CollegeTest getCollegeTest(@RequestParam("id") Integer id) {
+    public List<CollegeTest> getCollegeTest(@RequestParam("id") Integer id) {
         return collegeTestService.getCollegeTest(id);
     }
 
@@ -39,5 +42,15 @@ public class CollegeTestController {
         return collegeTestService.updateCollegeTest(collegeTest);
     }
 
+    @PostMapping("/college/queryTests")
+    public String queryTests(@RequestParam("openid") String openid,@RequestParam("core_id") Integer core_id) {
+        List<CollegeTest> orderTemps = collegeTestService.queryTests(openid,core_id);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+
+
+
 
 }

+ 11 - 3
src/main/java/com/ygj/yuemum/controller/college/CollegeTestDetailController.java

@@ -1,14 +1,15 @@
 package com.ygj.yuemum.controller.college;
 
 
-import com.ygj.yuemum.domain.college.CollegeTest;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
 import com.ygj.yuemum.domain.college.CollegeTestDetail;
 import com.ygj.yuemum.service.college.CollegeTestDetailService;
-import com.ygj.yuemum.service.college.CollegeTestResultService;
-import com.ygj.yuemum.service.college.CollegeTestService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 
 @RestController
@@ -42,5 +43,12 @@ public class CollegeTestDetailController {
         return collegeTestDetailService.updateCollegeTestDetail(collegeTestDetail);
     }
 
+    @PostMapping("/college/addTestDetail")
+    public String addTestDetail(@RequestParam("openid") String openid,@RequestParam("core_id") Integer core_id,@RequestParam("answers") String answers) {
+        LinkedHashMap<String, Object> orderTemps = collegeTestDetailService.addTestDetail(openid,core_id,answers);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
 
 }

+ 25 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeBookingDao.java

@@ -0,0 +1,25 @@
+package com.ygj.yuemum.dao.college;
+
+import com.ygj.yuemum.domain.college.CollegeBooking;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CollegeBookingDao {
+
+    List<CollegeBooking> getAll();
+
+    CollegeBooking selectByPrimaryKey(Integer id);
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CollegeBooking record);
+
+    int updateByPrimaryKeySelective(CollegeBooking record);
+
+    CollegeBooking checkBooking(CollegeBooking collegeBooking);
+
+    int bookingCancel (CollegeBooking collegeBooking);
+
+}

+ 4 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumCoreDao.java

@@ -23,4 +23,8 @@ public interface CollegeCurriculumCoreDao {
     ReturnUserLearningCoreDetail queryUserLearningCoreDetail (CollegeCurriculumQuery collegeCurriculumQuery);
     ReturnUserLearningCoreDetail queryCoreDetail (CollegeCurriculumQuery collegeCurriculumQuery);
 
+    int updatePositive(String c_code);
+
+    CollegeCurriculumCore queryCoreByCode(String c_code);
+
 }

+ 8 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumExperienceDao.java

@@ -2,6 +2,7 @@ package com.ygj.yuemum.dao.college;
 
 import com.ygj.yuemum.domain.college.CollegeCurriculumExperience;
 import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
+import com.ygj.yuemum.domain.college.CollegeQuery;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -10,13 +11,20 @@ import java.util.List;
 public interface CollegeCurriculumExperienceDao {
 
     List<CollegeCurriculumExperience> getAll();
+
     CollegeCurriculumExperience selectByPrimaryKey(Integer id);
+
     int deleteByPrimaryKey(Integer id);
+
     int insertSelective(CollegeCurriculumExperience record);
+
     int updateByPrimaryKeySelective(CollegeCurriculumExperience record);
 
     List<CollegeCurriculumExperience> queryExperienceByStep(CollegeCurriculumExperience record);
 
     List<CollegeCurriculumExperience> queryUserLearningExperience(CollegeCurriculumQuery collegeCurriculumQuery);
 
+    CollegeCurriculumExperience queryExperienceDetail(CollegeQuery collegePracticeQuery);
+
+
 }

+ 4 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumPracticeDao.java

@@ -2,6 +2,7 @@ package com.ygj.yuemum.dao.college;
 
 import com.ygj.yuemum.domain.college.CollegeCurriculumPractice;
 import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
+import com.ygj.yuemum.domain.college.CollegeQuery;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -22,4 +23,7 @@ public interface CollegeCurriculumPracticeDao {
     List<CollegeCurriculumPractice> queryPracticeByStep(CollegeCurriculumPractice record);
 
     List<CollegeCurriculumPractice> queryUserLearningPractice(CollegeCurriculumQuery collegeCurriculumQuery);
+    CollegeCurriculumPractice queryPracticeDetail(CollegeQuery collegePracticeQuery);
+
+
 }

+ 7 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeLearningDetailDao.java

@@ -17,4 +17,11 @@ public interface CollegeLearningDetailDao {
     int insertSelective(CollegeLearningDetail record);
 
     int updateByPrimaryKeySelective(CollegeLearningDetail record);
+
+
+    CollegeLearningDetail checkCorePositive(CollegeLearningDetail collegeLearningDetail);
+
+    CollegeLearningDetail checkCoreLearningRate(CollegeLearningDetail collegeLearningDetail);
+
+    int updateLearningRate (CollegeLearningDetail collegeLearningDetail);
 }

+ 3 - 1
src/main/java/com/ygj/yuemum/dao/college/CollegeTestDao.java

@@ -10,11 +10,13 @@ public interface CollegeTestDao {
 
     List<CollegeTest> getAll();
 
-    CollegeTest selectByPrimaryKey(Integer id);
+    List<CollegeTest> selectByPrimaryKey(Integer id);
 
     int deleteByPrimaryKey(Integer id);
 
     int insertSelective(CollegeTest record);
 
     int updateByPrimaryKeySelective(CollegeTest record);
+
+    List<CollegeTest> selectByCoreId(Integer core_id);
 }

+ 7 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeTestDetailDao.java

@@ -1,6 +1,7 @@
 package com.ygj.yuemum.dao.college;
 
 import com.ygj.yuemum.domain.college.CollegeTestDetail;
+import com.ygj.yuemum.domain.college.CollegeTestResult;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -17,4 +18,10 @@ public interface CollegeTestDetailDao {
     int insertSelective(CollegeTestDetail record);
 
     int updateByPrimaryKeySelective(CollegeTestDetail record);
+
+    CollegeTestDetail queryUserAnswers(CollegeTestDetail collegeTestDetail);
+
+    CollegeTestDetail selectByOpenId(CollegeTestDetail collegeTestDetail);
+
+
 }

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeTestResultDao.java

@@ -17,4 +17,6 @@ public interface CollegeTestResultDao {
     int insertSelective(CollegeTestResult record);
 
     int updateByPrimaryKeySelective(CollegeTestResult record);
+
+    List<CollegeTestResult> selectByTestId(Integer testid);
 }

+ 3 - 1
src/main/java/com/ygj/yuemum/dao/college/CollegeUserPointsDao.java

@@ -12,11 +12,13 @@ public interface CollegeUserPointsDao {
 
     CollegeUserPoints selectByPrimaryKey(Integer id);
 
-    CollegeUserPoints queryUserPoints(String openid);
+    CollegeUserPoints queryOneUserPoints(String openid);
 
     int deleteByPrimaryKey(Integer id);
 
     int insertSelective(CollegeUserPoints record);
 
     int updateByPrimaryKeySelective(CollegeUserPoints record);
+
+    int updatePointsByTest(String openid);
 }

+ 85 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeBooking.java

@@ -0,0 +1,85 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegeBooking {
+    private Integer id;
+    private String openid;
+    private String name;
+    private String phone;
+    private String date;
+    private String duedate;
+    private String college_code;
+    private Integer b_count;
+    private Integer b_time;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public String getDuedate() {
+        return duedate;
+    }
+
+    public void setDuedate(String duedate) {
+        this.duedate = duedate;
+    }
+
+    public String getCollege_code() {
+        return college_code;
+    }
+
+    public void setCollege_code(String college_code) {
+        this.college_code = college_code;
+    }
+
+    public Integer getB_count() {
+        return b_count;
+    }
+
+    public void setB_count(Integer b_count) {
+        this.b_count = b_count;
+    }
+
+    public Integer getB_time() {
+        return b_time;
+    }
+
+    public void setB_time(Integer b_time) {
+        this.b_time = b_time;
+    }
+}

+ 8 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumCore.java

@@ -25,9 +25,17 @@ public class CollegeCurriculumCore {
     private Integer negative;
     private String cd_code;
     private String status;
+    private String openid;
     private Integer page;
     private Integer limit;
 
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
 
     public Integer getC_seq() {
         return c_seq;

+ 36 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumExperience.java

@@ -18,8 +18,44 @@ public class CollegeCurriculumExperience {
     private String qrcode;
     private String cd_code;
     private String status;
+    private Integer bookingid;
+    private String learningStatus;
+    private String openid;
     private Integer page;
     private Integer limit;
+    private String img_href;
+
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
+
+    public Integer getBookingid() {
+        return bookingid;
+    }
+
+    public void setBookingid(Integer bookingid) {
+        this.bookingid = bookingid;
+    }
+
+    public String getLearningStatus() {
+        return learningStatus;
+    }
+
+    public void setLearningStatus(String learningStatus) {
+        this.learningStatus = learningStatus;
+    }
+
+    public String getImg_href() {
+        return img_href;
+    }
+
+    public void setImg_href(String img_href) {
+        this.img_href = img_href;
+    }
 
     public String getCd_code() {
         return cd_code;

+ 35 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumPractice.java

@@ -22,8 +22,43 @@ public class CollegeCurriculumPractice {
     private String status;
     private String qrcode;
     private Integer page;
+    private Integer bookingid;
+    private String openid;
+    private String learningStatus;
     private Integer limit;
+    private String img_href;
 
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
+
+    public String getLearningStatus() {
+        return learningStatus;
+    }
+
+    public void setLearningStatus(String learningStatus) {
+        this.learningStatus = learningStatus;
+    }
+
+    public Integer getBookingid() {
+        return bookingid;
+    }
+
+    public void setBookingid(Integer bookingid) {
+        this.bookingid = bookingid;
+    }
+
+    public String getImg_href() {
+        return img_href;
+    }
+
+    public void setImg_href(String img_href) {
+        this.img_href = img_href;
+    }
 
     public String getCd_code() {
         return cd_code;

+ 3 - 3
src/main/java/com/ygj/yuemum/domain/college/CollegeLearningDetail.java

@@ -8,15 +8,15 @@ public class CollegeLearningDetail {
     private Integer status;
     private String date;
     private Integer credit;
-    private Integer rate;
+    private Float rate;
     private Integer page;
     private Integer limit;
 
-    public Integer getRate() {
+    public Float getRate() {
         return rate;
     }
 
-    public void setRate(Integer rate) {
+    public void setRate(Float rate) {
         this.rate = rate;
     }
 

+ 31 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeQuery.java

@@ -0,0 +1,31 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegeQuery {
+    private String phone;
+    private String openid;
+    private String c_code;
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
+
+    public String getC_code() {
+        return c_code;
+    }
+
+    public void setC_code(String c_code) {
+        this.c_code = c_code;
+    }
+}

+ 47 - 9
src/main/java/com/ygj/yuemum/domain/college/CollegeTest.java

@@ -1,12 +1,58 @@
 package com.ygj.yuemum.domain.college;
 
+import java.util.List;
+
 public class CollegeTest {
     private Integer id;
     private String core_id;
     private String name;
+    private Integer seq;
     private Integer score;
-    private Integer credit;
     private String desc;
+    private List<CollegeTestResult> collegeTestResults;
+    private String comment;
+    private String userAnswer;
+    private boolean result;
+
+    public boolean isResult() {
+        return result;
+    }
+
+    public void setResult(boolean result) {
+        this.result = result;
+    }
+
+    public String getUserAnswer() {
+        return userAnswer;
+    }
+
+    public void setUserAnswer(String userAnswer) {
+        this.userAnswer = userAnswer;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public List<CollegeTestResult> getCollegeTestResults() {
+        return collegeTestResults;
+    }
+
+    public void setCollegeTestResults(List<CollegeTestResult> collegeTestResults) {
+        this.collegeTestResults = collegeTestResults;
+    }
+
+    public Integer getSeq() {
+        return seq;
+    }
+
+    public void setSeq(Integer seq) {
+        this.seq = seq;
+    }
 
     public Integer getId() {
         return id;
@@ -40,14 +86,6 @@ public class CollegeTest {
         this.score = score;
     }
 
-    public Integer getCredit() {
-        return credit;
-    }
-
-    public void setCredit(Integer credit) {
-        this.credit = credit;
-    }
-
     public String getDesc() {
         return desc;
     }

+ 14 - 5
src/main/java/com/ygj/yuemum/domain/college/CollegeTestDetail.java

@@ -3,9 +3,18 @@ package com.ygj.yuemum.domain.college;
 public class CollegeTestDetail {
     private Integer id;
     private String openid;
-    private Integer testid;
+    private Integer coreid;
     private Integer status;
     private Integer result;
+    private String answers;
+
+    public String getAnswers() {
+        return answers;
+    }
+
+    public void setAnswers(String answers) {
+        this.answers = answers;
+    }
 
     public Integer getId() {
         return id;
@@ -23,12 +32,12 @@ public class CollegeTestDetail {
         this.openid = openid;
     }
 
-    public Integer getTestid() {
-        return testid;
+    public Integer getCoreid() {
+        return coreid;
     }
 
-    public void setTestid(Integer testid) {
-        this.testid = testid;
+    public void setCoreid(Integer coreid) {
+        this.coreid = coreid;
     }
 
     public Integer getStatus() {

+ 3 - 12
src/main/java/com/ygj/yuemum/domain/college/CollegeTestResult.java

@@ -5,16 +5,7 @@ public class CollegeTestResult {
     private Integer testid;
     private Integer seq;
     private String result_desc;
-    private Integer isright;
-    private Integer score;
-
-    public Integer getScore() {
-        return score;
-    }
-
-    public void setScore(Integer score) {
-        this.score = score;
-    }
+    private boolean isright;
 
     public Integer getId() {
         return id;
@@ -48,11 +39,11 @@ public class CollegeTestResult {
         this.result_desc = result_desc;
     }
 
-    public Integer getIsright() {
+    public boolean isIsright() {
         return isright;
     }
 
-    public void setIsright(Integer isright) {
+    public void setIsright(boolean isright) {
         this.isright = isright;
     }
 }

+ 21 - 3
src/main/java/com/ygj/yuemum/domain/college/ReturnUserLearningCoreDetail.java

@@ -14,10 +14,28 @@ public class ReturnUserLearningCoreDetail {
     private String video_length;
     private boolean isvideo;
     private boolean istest;
+    private Integer id;
+    private Integer testid;
     private Integer positive;
     private  Integer result;
     private Integer status;
-    private Integer rate;
+    private Float rate;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getTestid() {
+        return testid;
+    }
+
+    public void setTestid(Integer testid) {
+        this.testid = testid;
+    }
 
     public String getC_content() {
         return c_content;
@@ -147,11 +165,11 @@ public class ReturnUserLearningCoreDetail {
         this.status = status;
     }
 
-    public Integer getRate() {
+    public Float getRate() {
         return rate;
     }
 
-    public void setRate(Integer rate) {
+    public void setRate(Float rate) {
         this.rate = rate;
     }
 }

+ 70 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeBookingService.java

@@ -0,0 +1,70 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegeBookingDao;
+import com.ygj.yuemum.dao.college.CollegeTestDao;
+import com.ygj.yuemum.domain.college.CollegeBooking;
+import com.ygj.yuemum.domain.college.CollegeLearningDetail;
+import com.ygj.yuemum.domain.college.CollegeTest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class CollegeBookingService {
+
+    @Autowired
+    private CollegeBookingDao collegeBookingDao;
+    @Autowired
+    private CollegeLearningDetailService collegeLearningDetailService;
+
+    public List<CollegeBooking> getCollegeBookings() {
+        List<CollegeBooking> collegeBookings = collegeBookingDao.getAll();
+        return collegeBookings;
+    }
+
+    public CollegeBooking getCollegeBooking(Integer id) {
+        return collegeBookingDao.selectByPrimaryKey(id);
+    }
+
+    public int addCollegeBooking(CollegeBooking collegeBooking) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        CollegeBooking collegeBooking1 = collegeBookingDao.checkBooking(collegeBooking);
+        if( collegeBooking1 != null) {
+            collegeBooking.setId(collegeBooking1.getId());
+            int tt = collegeBookingDao.updateByPrimaryKeySelective(collegeBooking);
+            return  tt;
+        } else {
+            try {
+                collegeBooking.setDate(sdf.format(new Date()));
+                CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+                collegeLearningDetail.setOpen_id(collegeBooking.getOpenid());
+                collegeLearningDetail.setC_code(collegeBooking.getCollege_code());
+                collegeLearningDetail.setDate(sdf.format(new Date()));
+                collegeLearningDetail.setStatus(1);
+                collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail);
+                collegeBookingDao.insertSelective(collegeBooking);
+                return 1;
+            }catch (Exception ex){
+                ex.printStackTrace();
+                return 0;
+            }
+        }
+
+    }
+
+    public int deleteCollegeBooking(Integer id) {
+        return collegeBookingDao.deleteByPrimaryKey(id);
+    }
+
+    public int updateCollegeBooking(CollegeBooking collegeBooking) {
+        return collegeBookingDao.updateByPrimaryKeySelective(collegeBooking);
+    }
+
+    public int bookingCancel(CollegeBooking collegeBooking) {
+        return collegeBookingDao.bookingCancel(collegeBooking);
+    }
+
+}

+ 145 - 44
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumCoreService.java

@@ -2,9 +2,8 @@ package com.ygj.yuemum.service.college;
 
 import com.ygj.yuemum.component.Constant;
 import com.ygj.yuemum.dao.college.CollegeCurriculumCoreDao;
-import com.ygj.yuemum.domain.college.CollegeCurriculumCore;
-import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
-import com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail;
+import com.ygj.yuemum.dao.college.CollegeLearningDetailDao;
+import com.ygj.yuemum.domain.college.*;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import com.ygj.yuemum.utils.DateUtil;
@@ -26,6 +25,10 @@ public class CollegeCurriculumCoreService {
     private CollegeCurriculumCoreDao collegeCurriculumCoreDao;
     @Autowired
     private WXUserService wxUserService;
+    @Autowired
+    private CollegeLearningDetailService collegeLearningDetailService;
+    @Autowired
+    private CollegeUserPointsService collegeUserPointsService;
 
     public List<CollegeCurriculumCore> getCollegeCurriculumCores() {
         List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreDao.getAll();
@@ -66,11 +69,11 @@ public class CollegeCurriculumCoreService {
                     CollegeCurriculumQuery collegeCurriculumQueryP = new CollegeCurriculumQuery();
                     collegeCurriculumQueryB.setC_type("B01");
                     collegeCurriculumQueryB.setOpenid(openid);
-                    if(dateNow.getTime() < getDate.getTime()) {
+                    if (dateNow.getTime() < getDate.getTime()) {
                         //还没出生
                         return null;
                     } else {
-                        if(DateUtil.getMonthDiff(dateNow, getDate) + 1 > AGE) {
+                        if (DateUtil.getMonthDiff(dateNow, getDate) + 1 > AGE) {
                             collegeCurriculumQueryB.setC_step(AGE);
                         } else {
                             collegeCurriculumQueryB.setC_step(AGE - DateUtil.getMonthDiff(dateNow, getDate) + 1);
@@ -78,8 +81,8 @@ public class CollegeCurriculumCoreService {
                     }
                     //育儿课程加孕周课程
                     List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreDao.queryUserLearningCore(collegeCurriculumQueryB);
-                    for(CollegeCurriculumCore collegeCurriculumCore:collegeCurriculumCores){
-                        if(collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
+                    for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
+                        if (collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
                         } else {
                             if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
@@ -88,52 +91,52 @@ public class CollegeCurriculumCoreService {
                                 collegeCurriculumCore.setStatus("未完成");
                             }
                         }
-                        tableData.put("collegeCurriculumCores_b",collegeCurriculumCores);
+                        tableData.put("collegeCurriculumCores_b", collegeCurriculumCores);
                     }
                     collegeCurriculumQueryP.setC_type("P01");
                     collegeCurriculumQueryP.setOpenid(openid);
                     collegeCurriculumQueryP.setC_step(LMP);
                     List<CollegeCurriculumCore> collegeCurriculumCore_p = collegeCurriculumCoreDao.queryUserLearningCore(collegeCurriculumQueryP);
-                    for(CollegeCurriculumCore collegeCurriculumCore:collegeCurriculumCore_p){
-                        if(collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
+                    for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCore_p) {
+                        if (collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
                         } else {
-                            if ( collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate) ) {
+                            if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
                             }
                         }
-                        tableData.put("collegeCurriculumCores_p",collegeCurriculumCore_p);
+                        tableData.put("collegeCurriculumCores_p", collegeCurriculumCore_p);
                     }
                     return tableData;
                 } else if (wxUser.getXu_content_type().equals("P01")) {
                     CollegeCurriculumQuery collegeCurriculumQuery = new CollegeCurriculumQuery();
                     collegeCurriculumQuery.setC_type(wxUser.getXu_content_type());
                     collegeCurriculumQuery.setOpenid(openid);
-                    if(dateNow.getTime() < getDate.getTime()) {
-                        if (LMP-DateUtil.getWeekDiff(dateNow, getDate) < 0) {
+                    if (dateNow.getTime() < getDate.getTime()) {
+                        if (LMP - DateUtil.getWeekDiff(dateNow, getDate) < 0) {
                             return null; //还没怀孕
                         } else {
-                            collegeCurriculumQuery.setC_step(LMP-DateUtil.getWeekDiff(dateNow, getDate));
+                            collegeCurriculumQuery.setC_step(LMP - DateUtil.getWeekDiff(dateNow, getDate));
                         }
-                    }else {
+                    } else {
                         collegeCurriculumQuery.setC_step(LMP); //已出生
                     }
                     //孕周课程
                     List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreDao.queryUserLearningCore(collegeCurriculumQuery);
-                    for(CollegeCurriculumCore collegeCurriculumCore:collegeCurriculumCores){
-                        if(collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
+                    for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
+                        if (collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
                         } else {
-                            if ( collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate) ) {
+                            if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
                             }
                         }
                     }
-                    tableData.put("collegeCurriculumCores_p",collegeCurriculumCores);
+                    tableData.put("collegeCurriculumCores_p", collegeCurriculumCores);
                     return tableData;
                 } else {
                     return null;
@@ -150,48 +153,146 @@ public class CollegeCurriculumCoreService {
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
         LinkedHashMap<String, Object> list = new LinkedHashMap<>();
         ReturnUserLearningCoreDetail returnUserLearningCoreDetail = collegeCurriculumCoreDao.queryUserLearningCoreDetail(collegeCurriculumQuery);
-        tableData.put("curriculumDetail",returnUserLearningCoreDetail);
+        tableData.put("curriculumDetail", returnUserLearningCoreDetail);
         if (returnUserLearningCoreDetail.isIsvideo()) {
-            list.put("collegeName",returnUserLearningCoreDetail.getC_name());
-            list.put("collegeDesc","文档课件"); //先写死
-            if(returnUserLearningCoreDetail.getStatus() != null && returnUserLearningCoreDetail.getStatus() == 9) {
-                list.put("collegeStatus","完成度100%");
+            list.put("collegeName", returnUserLearningCoreDetail.getC_name());
+            list.put("collegeDesc", "文档课件"); //先写死
+            list.put("collegeId", returnUserLearningCoreDetail.getId());
+            if (returnUserLearningCoreDetail.getStatus() != null && returnUserLearningCoreDetail.getStatus() == 9) {
+                list.put("collegeStatus", "完成度100%");
+                list.put("collegeFinish", "已完成");
             } else if (returnUserLearningCoreDetail.getStatus() != null && returnUserLearningCoreDetail.getStatus() == 2) {
-                list.put("collegeStatus","完成度"+returnUserLearningCoreDetail.getRate()+"%");
+                list.put("collegeStatus", "完成度" + returnUserLearningCoreDetail.getRate() + "%");
+                list.put("collegeFinish", "未完成");
             } else {
-                list.put("collegeStatus","完成度0%");
+                list.put("collegeStatus", "完成度0%");
+                list.put("collegeFinish", "未完成");
             }
         }
-        if(returnUserLearningCoreDetail.isIstest()) {
-            list.put("testName","本期课程测验");  //先写死
-            list.put("fullCredit","满分100分"); //先写死
+        if (returnUserLearningCoreDetail.isIstest()) {
+            list.put("testName", "本期课程测验");  //先写死
+            list.put("fullCredit", "满分100分"); //先写死
+            list.put("testId", returnUserLearningCoreDetail.getTestid());
             if (returnUserLearningCoreDetail.getResult() != null) {
-                list.put("testResult","您的成绩为"+returnUserLearningCoreDetail.getResult()+"分");
+                list.put("testResult", "您的成绩为" + returnUserLearningCoreDetail.getResult() + "分");
+                list.put("testFinish", "已完成");
             } else {
-                list.put("testResult","您尚未参与考试");
+                list.put("testResult", "您尚未参与考试");
+                list.put("testFinish", "未完成");
             }
         }
-        tableData.put("curriculumList",list);
+        tableData.put("curriculumList", list);
         return tableData;
     }
 
-    public LinkedHashMap<String, Object> queryCoreDetail(String openid,int id) {
+    public LinkedHashMap<String, Object> queryCoreDetail(String openid, int id) {
         CollegeCurriculumQuery collegeCurriculumQuery = new CollegeCurriculumQuery();
         collegeCurriculumQuery.setId(id);
         collegeCurriculumQuery.setOpenid(openid);
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
         ReturnUserLearningCoreDetail returnUserLearningCoreDetail = collegeCurriculumCoreDao.queryCoreDetail(collegeCurriculumQuery);
-        tableData.put("c_name",returnUserLearningCoreDetail.getC_name());
-        tableData.put("pcount",returnUserLearningCoreDetail.getPcount());
-        tableData.put("t_image_href",returnUserLearningCoreDetail.getT_image_href());
-        tableData.put("t_name",returnUserLearningCoreDetail.getT_name());
-        tableData.put("c_content",returnUserLearningCoreDetail.getC_content());
-        tableData.put("positive",returnUserLearningCoreDetail.getPositive());
-        tableData.put("t_desc",returnUserLearningCoreDetail.getT_desc());
-        tableData.put("isvideo",returnUserLearningCoreDetail.isIsvideo());
-        tableData.put("status",returnUserLearningCoreDetail.getStatus());
-        tableData.put("rate",returnUserLearningCoreDetail.getRate());
+        tableData.put("c_name", returnUserLearningCoreDetail.getC_name());
+        tableData.put("pcount", returnUserLearningCoreDetail.getPcount());
+        tableData.put("t_image_href", returnUserLearningCoreDetail.getT_image_href());
+        tableData.put("t_name", returnUserLearningCoreDetail.getT_name());
+        tableData.put("c_content", returnUserLearningCoreDetail.getC_content());
+        tableData.put("positive", returnUserLearningCoreDetail.getPositive());
+        tableData.put("t_desc", returnUserLearningCoreDetail.getT_desc());
+        tableData.put("isvideo", returnUserLearningCoreDetail.isIsvideo());
+        tableData.put("status", returnUserLearningCoreDetail.getStatus());
+        tableData.put("rate", returnUserLearningCoreDetail.getRate());
         return tableData;
     }
 
+    public int corePositive(String openid, String c_code) {
+        CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+        collegeLearningDetail.setOpen_id(openid);
+        collegeLearningDetail.setC_code(c_code);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (collegeLearningDetailService.checkCorePositive(collegeLearningDetail) == null) {
+            try {
+                CollegeLearningDetail collegeLearningDetailNew = new CollegeLearningDetail();
+                collegeLearningDetailNew.setOpen_id(openid);
+                collegeLearningDetailNew.setC_code(c_code);
+                collegeLearningDetailNew.setStatus(8);
+                collegeLearningDetailNew.setDate(sdf.format(new Date()));
+                collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetailNew);
+                collegeCurriculumCoreDao.updatePositive(c_code);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                return 0;
+            }
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
+    public int coreLearningFinish(String openid, String c_code) {
+        CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        collegeLearningDetail.setOpen_id(openid);
+        collegeLearningDetail.setC_code(c_code);
+        CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkCoreLearningRate(collegeLearningDetail);
+        if (collegeLearningDetailOld != null && collegeLearningDetailOld.getStatus() ==9) {
+            return 0;
+        } else {
+            //加学分 更新日志
+            CollegeUserPoints collegeUserPoints = collegeUserPointsService.queryOneUserPoints(openid);
+            CollegeCurriculumCore collegeCurriculumCore = collegeCurriculumCoreDao.queryCoreByCode(c_code);
+            CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints();
+            collegeUserPointsNew.setOpenid(openid);
+            if (collegeUserPoints != null) {
+                collegeUserPointsNew.setId(collegeUserPoints.getId());
+
+                collegeUserPointsNew.setCredit_available(collegeUserPoints.getCredit_available() + collegeCurriculumCore.getCredit());
+                collegeUserPointsNew.setCredit_total(collegeUserPoints.getCredit_total() + collegeCurriculumCore.getCredit());
+                collegeUserPointsService.updateCollegeUserPoints(collegeUserPointsNew);
+            } else {
+                collegeUserPointsNew.setCredit_available(collegeCurriculumCore.getCredit());
+                collegeUserPointsNew.setCredit_total(collegeCurriculumCore.getCredit());
+                collegeUserPointsService.addCollegeUserPoints(collegeUserPointsNew);
+            }
+            CollegeLearningDetail collegeLearningDetail1 = new CollegeLearningDetail();
+            collegeLearningDetail1.setOpen_id(openid);
+            collegeLearningDetail1.setC_code(c_code);
+            collegeLearningDetail1.setDate(sdf.format(new Date()));
+            collegeLearningDetail1.setCredit(collegeCurriculumCore.getCredit());
+            collegeLearningDetail1.setStatus(9);
+            collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail1);
+            return 1;
+        }
+    }
+
+    public int coreLearningUpdate(String openid, String c_code, Float rate) {
+        CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        collegeLearningDetail.setOpen_id(openid);
+        collegeLearningDetail.setC_code(c_code);
+        CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkCoreLearningRate(collegeLearningDetail);
+        if(collegeLearningDetailOld == null) {
+            collegeLearningDetail.setRate(rate);
+            collegeLearningDetail.setDate(sdf.format(new Date()));
+            collegeLearningDetail.setStatus(1);
+            collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail);
+            return 1;
+        } else {
+            if(collegeLearningDetailOld.getStatus() == 9) {
+                return 0;
+            } else {
+                if (rate > collegeLearningDetailOld.getRate()) {
+                    collegeLearningDetail.setId(collegeLearningDetailOld.getId());
+                    collegeLearningDetail.setRate(rate);
+                    collegeLearningDetail.setStatus(1);
+                    collegeLearningDetail.setDate(sdf.format(new Date()));
+                    collegeLearningDetailService.updateCollegeLearningDetail(collegeLearningDetail);
+                    return 1;
+                } else {
+                    return 0;
+                }
+            }
+
+        }
+    }
+
 }

+ 19 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumExperienceService.java

@@ -5,12 +5,14 @@ import com.ygj.yuemum.dao.college.CollegeCurriculumExperienceDao;
 import com.ygj.yuemum.domain.college.CollegeCurriculumExperience;
 import com.ygj.yuemum.domain.college.CollegeCurriculumPractice;
 import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
+import com.ygj.yuemum.domain.college.CollegeQuery;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import com.ygj.yuemum.utils.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.LinkedHashMap;
@@ -54,6 +56,23 @@ public class CollegeCurriculumExperienceService {
     }
 
 
+    public CollegeCurriculumExperience queryExperienceDetail(CollegeQuery collegeQuery) throws ParseException {
+        CollegeCurriculumExperience collegeCurriculumExperience = collegeCurriculumExperienceDao.queryExperienceDetail(collegeQuery);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if(collegeCurriculumExperience.getLearningStatus() != null && collegeCurriculumExperience.getLearningStatus().equals("9")){
+            collegeCurriculumExperience.setLearningStatus("已完成");
+            collegeCurriculumExperience.setStatus("已完成");
+        } else if(collegeCurriculumExperience.getLearningStatus() != null && collegeCurriculumExperience.getLearningStatus().equals("1")){
+            collegeCurriculumExperience.setLearningStatus("待完成");
+            collegeCurriculumExperience.setStatus("查看预约");
+        } else {
+            collegeCurriculumExperience.setLearningStatus("待完成");
+            collegeCurriculumExperience.setStatus("立即预约");
+        }
+        return collegeCurriculumExperience;
+    }
+
+
     public LinkedHashMap<String, Object> queryUserLearningExperience(String openid) {
         WXUser wxUser = wxUserService.getWXUser(openid);
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();

+ 34 - 5
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumPracticeService.java

@@ -1,18 +1,15 @@
 package com.ygj.yuemum.service.college;
 
 import com.ygj.yuemum.component.Constant;
-import com.ygj.yuemum.dao.college.CollegeCurriculumExperienceDao;
 import com.ygj.yuemum.dao.college.CollegeCurriculumPracticeDao;
-import com.ygj.yuemum.domain.college.CollegeCurriculumCore;
-import com.ygj.yuemum.domain.college.CollegeCurriculumExperience;
-import com.ygj.yuemum.domain.college.CollegeCurriculumPractice;
-import com.ygj.yuemum.domain.college.CollegeCurriculumQuery;
+import com.ygj.yuemum.domain.college.*;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import com.ygj.yuemum.utils.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.LinkedHashMap;
@@ -40,6 +37,38 @@ public class CollegeCurriculumPracticeService {
         return collegeCurriculumPractice;
     }
 
+    public CollegeCurriculumPractice queryPracticeDetail(CollegeQuery collegeQuery) throws ParseException {
+        CollegeCurriculumPractice collegeCurriculumPractice = collegeCurriculumPracticeDao.queryPracticeDetail(collegeQuery);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat sd = new SimpleDateFormat("MM-dd HH:mm");
+        long beginMillisecond = new Date().getTime();
+        long endMillisecond = sdf.parse(collegeCurriculumPractice.getDeadline()).getTime();
+        if(beginMillisecond > endMillisecond) {
+            if(collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("9")) {
+                collegeCurriculumPractice.setLearningStatus("已完成");
+                collegeCurriculumPractice.setStatus("已完成");
+            } else {
+                collegeCurriculumPractice.setLearningStatus("已过期");
+                collegeCurriculumPractice.setStatus("已过期");
+            }
+        } else {
+            if(collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("9")) {
+                collegeCurriculumPractice.setLearningStatus("已完成");
+                collegeCurriculumPractice.setStatus("已完成");
+            } else if (collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("1")) {
+                collegeCurriculumPractice.setLearningStatus("已报名");
+                collegeCurriculumPractice.setStatus("查看报名");
+            } else {
+                collegeCurriculumPractice.setLearningStatus("待完成");
+                collegeCurriculumPractice.setStatus("立即报名");
+            }
+        }
+        collegeCurriculumPractice.setStartdate(sd.format(sdf.parse(collegeCurriculumPractice.getStartdate())));
+        collegeCurriculumPractice.setEnddate(sd.format(sdf.parse(collegeCurriculumPractice.getEnddate())));
+        collegeCurriculumPractice.setDeadline(sd.format(sdf.parse(collegeCurriculumPractice.getDeadline())));
+        return collegeCurriculumPractice;
+    }
+
     public int addCollegeCurriculumPractice(CollegeCurriculumPractice collegeCurriculumPractice) {
         return collegeCurriculumPracticeDao.insertSelective(collegeCurriculumPractice);
     }

+ 11 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeLearningDetailService.java

@@ -37,4 +37,15 @@ public class CollegeLearningDetailService {
         return collegeLearningDetailDao.updateByPrimaryKeySelective(collegeLearningDetail);
     }
 
+    public CollegeLearningDetail  checkCorePositive(CollegeLearningDetail collegeLearningDetail) {
+        return collegeLearningDetailDao.checkCorePositive(collegeLearningDetail);
+    }
+    public CollegeLearningDetail  checkCoreLearningRate(CollegeLearningDetail collegeLearningDetail) {
+        return collegeLearningDetailDao.checkCoreLearningRate(collegeLearningDetail);
+    }
+
+    public int updateLearningRate(CollegeLearningDetail collegeLearningDetail) {
+        return collegeLearningDetailDao.updateLearningRate(collegeLearningDetail);
+    }
+
 }

+ 62 - 1
src/main/java/com/ygj/yuemum/service/college/CollegeTestDetailService.java

@@ -1,12 +1,15 @@
 package com.ygj.yuemum.service.college;
 
-import com.ygj.yuemum.dao.college.CollegeTestDao;
 import com.ygj.yuemum.dao.college.CollegeTestDetailDao;
 import com.ygj.yuemum.domain.college.CollegeTest;
 import com.ygj.yuemum.domain.college.CollegeTestDetail;
+import com.ygj.yuemum.domain.college.CollegeTestResult;
+import com.ygj.yuemum.domain.college.CollegeUserPoints;
+import org.omg.PortableInterceptor.INACTIVE;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 
 @Service
@@ -14,6 +17,12 @@ public class CollegeTestDetailService {
 
     @Autowired
     private CollegeTestDetailDao collegeTestDetailDao;
+    @Autowired
+    private CollegeTestResultService collegeTestResultService;
+    @Autowired
+    private CollegeTestService collegeTestService;
+    @Autowired
+    private CollegeUserPointsService collegeUserPointsService;
 
     public List<CollegeTestDetail> getCollegeTestDetails() {
         List<CollegeTestDetail> collegeTestDetails = collegeTestDetailDao.getAll();
@@ -37,4 +46,56 @@ public class CollegeTestDetailService {
         return collegeTestDetailDao.updateByPrimaryKeySelective(collegeTestDetail);
     }
 
+
+    public CollegeTestDetail queryUserAnswers (CollegeTestDetail collegeTestDetail) {
+        return collegeTestDetailDao.queryUserAnswers(collegeTestDetail);
+    }
+    public LinkedHashMap<String, Object> addTestDetail(String openid, Integer core_id, String answers) {
+        LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
+        CollegeTestDetail collegeTestDetailQuery = new CollegeTestDetail();
+        collegeTestDetailQuery.setOpenid(openid);
+        collegeTestDetailQuery.setCoreid(core_id);
+        if(collegeTestDetailDao.selectByOpenId(collegeTestDetailQuery) == null) {
+            CollegeTestDetail collegeTestDetail = new CollegeTestDetail();
+            collegeTestDetail.setCoreid(core_id);
+            collegeTestDetail.setOpenid(openid);
+            collegeTestDetail.setStatus(9);
+            String[] answersL = answers.split(",");
+            int score = 0;
+            int count = 0;
+            int i = 0;
+            List<CollegeTest> collegeTests = collegeTestService.selectByCoreId(core_id);
+            for (CollegeTest collegeTest: collegeTests) {
+                List<CollegeTestResult> collegeTestResults = collegeTestResultService.selectByTestId(collegeTest.getId());
+                for(CollegeTestResult collegeTestResult:collegeTestResults) {
+                    if(collegeTestResult.isIsright()&&answersL[i].equals(String.valueOf(collegeTestResult.getSeq()))){
+                        score = score + collegeTest.getScore();
+                        count = count + 1;
+                        break;
+                    }
+                }
+                i++;
+            }
+            tableData.put("score",score);
+            tableData.put("count",count);
+            //insert into Detail
+            collegeTestDetail.setResult(score);
+            collegeTestDetail.setAnswers(answers);
+            collegeTestDetailDao.insertSelective(collegeTestDetail);
+            //增加学分
+            if (collegeUserPointsService.queryOneUserPoints(openid) != null) {
+                collegeUserPointsService.updatePointsByTest(openid);
+            } else {
+                CollegeUserPoints collegeUserPoints = new CollegeUserPoints();
+                collegeUserPoints.setOpenid(openid);
+                collegeUserPoints.setCredit_available(1);
+                collegeUserPoints.setCredit_total(1);
+                collegeUserPointsService.addCollegeUserPoints(collegeUserPoints);
+            }
+            return tableData;
+        } else {
+            tableData.put("score","已做过测试");
+            return tableData;
+        }
+    }
 }

+ 5 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeTestResultService.java

@@ -35,4 +35,9 @@ public class CollegeTestResultService {
         return collegeTestResultDao.updateByPrimaryKeySelective(collegeTestResult);
     }
 
+    public List<CollegeTestResult> selectByTestId (Integer testid) {
+        return collegeTestResultDao.selectByTestId(testid);
+    }
+
+
 }

+ 55 - 3
src/main/java/com/ygj/yuemum/service/college/CollegeTestService.java

@@ -2,9 +2,15 @@ package com.ygj.yuemum.service.college;
 
 import com.ygj.yuemum.dao.college.CollegeTestDao;
 import com.ygj.yuemum.domain.college.CollegeTest;
+import com.ygj.yuemum.domain.college.CollegeTestDetail;
+import com.ygj.yuemum.domain.college.CollegeTestResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import sun.awt.geom.AreaOp;
 
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 
 @Service
@@ -12,15 +18,19 @@ public class CollegeTestService {
 
     @Autowired
     private CollegeTestDao collegeTestDao;
+    @Autowired
+    private CollegeTestResultService collegeTestResultService;
+    @Autowired
+    private CollegeTestDetailService collegeTestDetailService;
 
     public List<CollegeTest> getCollegeTests() {
         List<CollegeTest> collegeTests = collegeTestDao.getAll();
         return collegeTests;
     }
 
-    public CollegeTest getCollegeTest(Integer id) {
-        CollegeTest collegeTest = collegeTestDao.selectByPrimaryKey(id);
-        return collegeTest;
+    public List<CollegeTest> getCollegeTest(Integer id) {
+        List<CollegeTest> collegeTests = collegeTestDao.selectByPrimaryKey(id);
+        return collegeTests;
     }
 
     public int addCollegeTest(CollegeTest collegeTest) {
@@ -34,5 +44,47 @@ public class CollegeTestService {
     public int updateCollegeTest(CollegeTest collegeTest) {
         return collegeTestDao.updateByPrimaryKeySelective(collegeTest);
     }
+    public List<CollegeTest>  selectByCoreId(Integer core_id) {
+        return collegeTestDao.selectByCoreId(core_id);
+    }
+
+    public List<CollegeTest> queryTests(String openid, Integer core_id) {
+        // 查看用户之前的答案
+        CollegeTestDetail collegeTestDetailQuery = new CollegeTestDetail();
+        collegeTestDetailQuery.setCoreid(core_id);
+        collegeTestDetailQuery.setOpenid(openid);
+        String[] answers = null;
+        CollegeTestDetail collegeTestDetail = collegeTestDetailService.queryUserAnswers(collegeTestDetailQuery);
+        List<CollegeTest> collegeTestsReturn = new LinkedList<CollegeTest>();
+        List<CollegeTest> collegeTests = collegeTestDao.selectByCoreId(core_id);
+        answers = collegeTestDetail.getAnswers().split(",");
+        int i = 0;
+        for (CollegeTest collegeTest: collegeTests) {
+            CollegeTest collegeTestTemp = new CollegeTest();
+            List<CollegeTestResult> collegeTestResults = collegeTestResultService.selectByTestId(collegeTest.getId());
+            for(CollegeTestResult collegeTestResult:collegeTestResults){
+                if(collegeTestResult.isIsright()&&answers[i].equals(String.valueOf(collegeTestResult.getSeq()))){
+                    collegeTestTemp.setResult(true);
+                    break;
+                } else {
+                    collegeTestTemp.setResult(false);
+                }
+            }
+            collegeTestTemp.setId(collegeTest.getId());
+            collegeTestTemp.setSeq(collegeTest.getSeq());
+            collegeTestTemp.setName(collegeTest.getName());
+            collegeTestTemp.setDesc(collegeTest.getDesc());
+            collegeTestTemp.setScore(collegeTest.getScore());
+            collegeTestTemp.setCollegeTestResults(collegeTestResults);
+            collegeTestTemp.setComment(collegeTest.getComment());
+            collegeTestTemp.setUserAnswer(answers[i]);
+            i++;
+            collegeTestsReturn.add(collegeTestTemp);
+        }
+
+
+        return collegeTestsReturn;
+    }
+
 
 }

+ 120 - 109
src/main/java/com/ygj/yuemum/service/college/CollegeUserPointsService.java

@@ -68,133 +68,144 @@ public class CollegeUserPointsService {
     public int updateCollegeUserPoints(CollegeUserPoints collegeUserPoints) {
         return collegeUserPointsDao.updateByPrimaryKeySelective(collegeUserPoints);
     }
+    public int updatePointsByTest(String openid) {
+        return collegeUserPointsDao.updatePointsByTest(openid);
+    }
+    public CollegeUserPoints queryOneUserPoints(String openid) {
+        return collegeUserPointsDao.queryOneUserPoints(openid);
+    }
 
     public LinkedHashMap<String, Object> QueryUserPoints(String openid,String city) {
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
         WXUser wxUser = wxUserService.getWXUser(openid);
         tableData.put("stage", null);
         tableData.put("stage_date", null);
-        if (wxUser != null && wxUser.getXu_content_type() != null && wxUser.getXu_content_date() != null &&wxUser.getXu_phone() != null) {
-            try {
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                SimpleDateFormat ldf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                Date dateNow = new Date();
-                Date getDate = sdf.parse(wxUser.getXu_content_date());
-                CollegeCurriculumCore collegeCurriculumCoreQuery = new CollegeCurriculumCore();
-                CollegeCurriculumPractice collegeCurriculumPracticeQuery = new CollegeCurriculumPractice();
-                CollegeCurriculumExperience collegeCurriculumExperienceQuery = new CollegeCurriculumExperience();
-                CollegePointsDetail collegePointsDetail = new CollegePointsDetail();
-                if (wxUser.getXu_content_type().equals("B01")) { //育儿
-                    if(dateNow.getTime() < getDate.getTime()) {
-                        //还没出生
-                        return tableData;
-                    } else {
-                        if(DateUtil.getMonthDiff(dateNow, getDate) + 1 > AGE) {
+        if (wxUser != null  && wxUser.getXu_phone() != null) {
+            if (wxUser.getXu_content_type() != null && wxUser.getXu_content_date() != null) {
+                try {
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    SimpleDateFormat ldf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    Date dateNow = new Date();
+                    Date getDate = sdf.parse(wxUser.getXu_content_date());
+                    CollegeCurriculumCore collegeCurriculumCoreQuery = new CollegeCurriculumCore();
+                    CollegeCurriculumPractice collegeCurriculumPracticeQuery = new CollegeCurriculumPractice();
+                    CollegeCurriculumExperience collegeCurriculumExperienceQuery = new CollegeCurriculumExperience();
+                    CollegePointsDetail collegePointsDetail = new CollegePointsDetail();
+                    if (wxUser.getXu_content_type().equals("B01")) { //育儿
+                        if(dateNow.getTime() < getDate.getTime()) {
+                            //还没出生
                             return tableData;
                         } else {
-                            tableData.put("stage_step", DateUtil.getMonthDiff(dateNow, getDate) + 1);
-                            collegeCurriculumCoreQuery.setC_type("B01");
-                            collegeCurriculumCoreQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
-                            collegeCurriculumPracticeQuery.setC_type("B01");
-                            collegeCurriculumPracticeQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
-                            collegeCurriculumExperienceQuery.setC_type("B01");
-                            collegeCurriculumExperienceQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
+                            if(DateUtil.getMonthDiff(dateNow, getDate) + 1 > AGE) {
+                                return tableData;
+                            } else {
+                                tableData.put("stage_step", DateUtil.getMonthDiff(dateNow, getDate) + 1);
+                                collegeCurriculumCoreQuery.setC_type("B01");
+                                collegeCurriculumCoreQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
+                                collegeCurriculumPracticeQuery.setC_type("B01");
+                                collegeCurriculumPracticeQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
+                                collegeCurriculumExperienceQuery.setC_type("B01");
+                                collegeCurriculumExperienceQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1);
+                            }
                         }
-                    }
-                } else if (wxUser.getXu_content_type().equals("P01")) { //孕周
-                    if(dateNow.getTime() < getDate.getTime()) {
-                        if (LMP-DateUtil.getWeekDiff(dateNow, getDate) < 0) {
-                            return tableData; //还没怀孕
-                        } else {
-                            tableData.put("stage_step", DateUtil.getWeekDiff(dateNow, getDate));
-                            collegeCurriculumCoreQuery.setC_type("P01");
-                            collegeCurriculumCoreQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
-                            collegeCurriculumPracticeQuery.setC_type("P01");
-                            collegeCurriculumPracticeQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
-                            collegeCurriculumExperienceQuery.setC_type("P01");
-                            collegeCurriculumExperienceQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
+                    } else if (wxUser.getXu_content_type().equals("P01")) { //孕周
+                        if(dateNow.getTime() < getDate.getTime()) {
+                            if (LMP-DateUtil.getWeekDiff(dateNow, getDate) < 0) {
+                                return tableData; //还没怀孕
+                            } else {
+                                tableData.put("stage_step", DateUtil.getWeekDiff(dateNow, getDate));
+                                collegeCurriculumCoreQuery.setC_type("P01");
+                                collegeCurriculumCoreQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
+                                collegeCurriculumPracticeQuery.setC_type("P01");
+                                collegeCurriculumPracticeQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
+                                collegeCurriculumExperienceQuery.setC_type("P01");
+                                collegeCurriculumExperienceQuery.setC_step(DateUtil.getWeekDiff(dateNow, getDate));
+                            }
+                        }else {
+                            return tableData;
                         }
-                    }else {
+                    } else {
                         return tableData;
                     }
-                } else {
-                    return tableData;
-                }
-                tableData.put("stage", wxUser.getXu_content_type());
-                tableData.put("stage_date", wxUser.getXu_content_date());
-                tableData.put("avatar_url",wxUser.getXu_avatarUrl());
-                //查询学分
-                int point_available = 0;
-                CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryUserPoints(openid);
-                if (collegeUserPoints == null) {
-                    CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints();
-                    collegeUserPointsNew.setOpenid(openid);
-                    collegeUserPointsNew.setCredit_total(0);
-                    collegeUserPointsNew.setCredit_available(0);
-                    collegeUserPointsDao.insertSelective(collegeUserPointsNew);
-                    tableData.put("credit", 0);
-                } else {
-                    tableData.put("credit", collegeUserPoints.getCredit_total());
-                    point_available = collegeUserPoints.getCredit_available();
-                }
-                //礼品领取情况
-                List<CollegePresentRule> collegePresentRules =  collegePresentRuleService.queryUserReceived(openid);
-                for(CollegePresentRule collegePresentRule:collegePresentRules) {
-                    if(collegePresentRule.getReceived() != 1 && point_available >= collegePresentRule.getValue()) {
-                        //返回礼品内容
-                        tableData.put("surprise", "true");
-                        tableData.put("surprise_type", collegePresentRule.getType());
-                        tableData.put("surprise_name", collegePresentRule.getPresent_name());
-                        //自动发放礼品
-                        if (collegePresentRule.getType() == 1) {
-                            // 实物生成一条预约信息并发送通知
-                            CustomerBooking customerBooking = new CustomerBooking();
-                            customerBooking.setBk_branches_id(Integer.valueOf(city));
-                            customerBooking.setBk_phone(wxUser.getXu_phone());
-                            customerBooking.setBk_date(ldf.format(new Date()));
-                            customerBooking.setBk_type(6);
-                            customerBooking.setBk_desc(collegePresentRule.getPresent_name());
-                            customerBookingService.insertCustomerBooking(customerBooking);
-                            weChatInfoController.WXSendBookingMessage(customerBooking);
-                            collegePointsDetail.setContext(collegePresentRule.getPresent_name());
-                        } else {
-                            //优惠券领取接口  ???
-                            String cb_code = couponCreateService.couponIssue(collegePresentRule.getCoupon_cid(),wxUser.getXu_phone());
-                            collegePointsDetail.setContext(collegePresentRule.getPresent_name()+":"+cb_code);
+                    tableData.put("stage", wxUser.getXu_content_type());
+                    tableData.put("stage_date", wxUser.getXu_content_date());
+                    tableData.put("avatar_url",wxUser.getXu_avatarUrl());
+                    //查询学分
+                    int point_available = 0;
+                    CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid);
+                    if (collegeUserPoints == null) {
+                        CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints();
+                        collegeUserPointsNew.setOpenid(openid);
+                        collegeUserPointsNew.setCredit_total(0);
+                        collegeUserPointsNew.setCredit_available(0);
+                        collegeUserPointsDao.insertSelective(collegeUserPointsNew);
+                        tableData.put("credit", 0);
+                    } else {
+                        tableData.put("credit", collegeUserPoints.getCredit_total());
+                        point_available = collegeUserPoints.getCredit_available();
+                    }
+                    //礼品领取情况
+                    List<CollegePresentRule> collegePresentRules =  collegePresentRuleService.queryUserReceived(openid);
+                    for(CollegePresentRule collegePresentRule:collegePresentRules) {
+                        if(collegePresentRule.getReceived() != 1 && point_available >= collegePresentRule.getValue()) {
+                            //返回礼品内容
+                            tableData.put("surprise", "true");
+                            tableData.put("surprise_type", collegePresentRule.getType());
+                            tableData.put("surprise_name", collegePresentRule.getPresent_name());
+                            //自动发放礼品
+                            if (collegePresentRule.getType() == 1) {
+                                // 实物生成一条预约信息并发送通知
+                                CustomerBooking customerBooking = new CustomerBooking();
+                                customerBooking.setBk_branches_id(Integer.valueOf(city));
+                                customerBooking.setBk_phone(wxUser.getXu_phone());
+                                customerBooking.setBk_date(ldf.format(new Date()));
+                                customerBooking.setBk_type(6);
+                                customerBooking.setBk_desc(collegePresentRule.getPresent_name());
+                                customerBookingService.insertCustomerBooking(customerBooking);
+                                weChatInfoController.WXSendBookingMessage(customerBooking);
+                                collegePointsDetail.setContext(collegePresentRule.getPresent_name());
+                            } else {
+                                //优惠券领取接口  ???
+                                String cb_code = couponCreateService.couponIssue(collegePresentRule.getCoupon_cid(),wxUser.getXu_phone());
+                                collegePointsDetail.setContext(collegePresentRule.getPresent_name()+":"+cb_code);
+                            }
+                            //保存领取日志
+                            collegePointsDetail.setOpenid(openid);
+                            collegePointsDetail.setDate(ldf.format(new Date()));
+                            collegePointsDetail.setEvent_code(4);
+                            collegePointsDetail.setCredit(collegePresentRule.getValue() * -1);
+                            collegePointsDetailService.addCollegePointsDetail(collegePointsDetail);
+                            //更新学分
+                            collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue());
+                            collegeUserPointsDao.updateByPrimaryKeySelective(collegeUserPoints);
+                            break;
                         }
-                        //保存领取日志
-                        collegePointsDetail.setOpenid(openid);
-                        collegePointsDetail.setDate(ldf.format(new Date()));
-                        collegePointsDetail.setEvent_code(4);
-                        collegePointsDetail.setCredit(collegePresentRule.getValue() * -1);
-                        collegePointsDetailService.addCollegePointsDetail(collegePointsDetail);
-                        //更新学分
-                        collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue());
-                        collegeUserPointsDao.updateByPrimaryKeySelective(collegeUserPoints);
-                        break;
                     }
+                    tableData.put("present_received", collegePresentRules);
+                    //常规课
+                    List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreService.queryCoreByStep(collegeCurriculumCoreQuery);
+                    tableData.put("college_core",collegeCurriculumCores);
+                    //实践课
+                    collegeCurriculumPracticeQuery.setDeadline(sdf.format(new Date()));
+                    collegeCurriculumPracticeQuery.setCity(city);
+                    collegeCurriculumPracticeQuery.setStartdate(sdf.format(new Date()));
+                    List<CollegeCurriculumPractice> collegeCurriculumPractices = collegeCurriculumPracticeService.queryPracticeByStep(collegeCurriculumPracticeQuery);
+                    tableData.put("college_practice",collegeCurriculumPractices);
+                    //体验课
+                    collegeCurriculumExperienceQuery.setCity(city);
+                    List<CollegeCurriculumExperience> collegeCurriculumExperiences = collegeCurriculumExperienceService.queryExperienceByStep(collegeCurriculumExperienceQuery);
+                    tableData.put("college_experience",collegeCurriculumExperiences);
+                    return tableData;
+                } catch (Exception ex) {
+                    ex.printStackTrace();
+                    return tableData;
                 }
-                tableData.put("present_received", collegePresentRules);
-                //常规课
-                List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreService.queryCoreByStep(collegeCurriculumCoreQuery);
-                tableData.put("college_core",collegeCurriculumCores);
-                //实践课
-                collegeCurriculumPracticeQuery.setDeadline(sdf.format(new Date()));
-                collegeCurriculumPracticeQuery.setCity(city);
-                collegeCurriculumPracticeQuery.setStartdate(sdf.format(new Date()));
-                List<CollegeCurriculumPractice> collegeCurriculumPractices = collegeCurriculumPracticeService.queryPracticeByStep(collegeCurriculumPracticeQuery);
-                tableData.put("college_practice",collegeCurriculumPractices);
-                //体验课
-                collegeCurriculumExperienceQuery.setCity(city);
-                List<CollegeCurriculumExperience> collegeCurriculumExperiences = collegeCurriculumExperienceService.queryExperienceByStep(collegeCurriculumExperienceQuery);
-                tableData.put("college_experience",collegeCurriculumExperiences);
-                return tableData;
-            } catch (Exception ex) {
-                ex.printStackTrace();
+            } else {
+                tableData.put("status", "5"); //没有设置日期
                 return tableData;
             }
         } else {
-            tableData.put("Tips", "请授权微信小程序用");
+            tableData.put("status", "6"); //没有授权手机号
             return tableData;
         }
     }

+ 10 - 0
src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java

@@ -124,6 +124,16 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/college/queryUserLearningExperience","anon");
         filterChainDefinitionMap.put("/college/queryUserLearningCoreDetail","anon");
         filterChainDefinitionMap.put("/college/queryCoreDetail","anon");
+        filterChainDefinitionMap.put("/college/queryTests","anon");
+        filterChainDefinitionMap.put("/college/addTestDetail","anon");
+        filterChainDefinitionMap.put("/college/queryPracticeDetail","anon");
+        filterChainDefinitionMap.put("/college/queryExperienceDetail","anon");
+        filterChainDefinitionMap.put("/college/addCollegeBooking","anon");
+        filterChainDefinitionMap.put("/college/corePositive","anon");
+        filterChainDefinitionMap.put("/college/coreLearningUpdate","anon");
+        filterChainDefinitionMap.put("/college/coreLearningFinish","anon");
+        filterChainDefinitionMap.put("/college/getCollegeBooking","anon");
+        filterChainDefinitionMap.put("/college/bookingCancel","anon");
 //        //用户,需要角色权限 “user”
 //        filterChainDefinitionMap.put("/user/**", "roles[user]");
 //        //管理员,需要角色权限 “admin”

+ 143 - 0
src/main/resources/mybatis/mapper/college/CollegeBookingMapper.xml

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ygj.yuemum.dao.college.CollegeBookingDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegeBooking" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="openid" property="openid" jdbcType="VARCHAR" />
+        <result column="name" property="name" jdbcType="VARCHAR" />
+        <result column="phone" property="phone" jdbcType="VARCHAR" />
+        <result column="date" property="date" jdbcType="DATE" />
+        <result column="duedate" property="duedate" jdbcType="DATE" />
+        <result column="college_code" property="college_code" jdbcType="VARCHAR" />
+        <result column="b_count" property="b_count" jdbcType="INTEGER" />
+        <result column="b_time" property="b_time" jdbcType="INTEGER" />
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegeBooking" >
+        select
+        *
+        from college_booking
+        order by id desc
+    </select>
+
+
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeBooking" parameterType="java.lang.Integer" >
+        select
+        *
+        from college_booking
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+
+    <select id="checkBooking" resultType="com.ygj.yuemum.domain.college.CollegeBooking" parameterType="com.ygj.yuemum.domain.college.CollegeBooking" >
+        select
+        *
+        from college_booking
+        where openid = #{openid,jdbcType=VARCHAR}
+        and phone = #{phone,jdbcType=VARCHAR}
+        and college_code = #{college_code,jdbcType=VARCHAR}
+    </select>
+
+
+    <delete id="bookingCancel" parameterType="com.ygj.yuemum.domain.college.CollegeBooking"  >
+        delete from college_booking
+        where openid = #{openid,jdbcType=VARCHAR}
+        and phone = #{phone,jdbcType=VARCHAR}
+        and college_code = #{college_code,jdbcType=VARCHAR}
+    </delete>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+        delete from college_booking
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeBooking" >
+        insert into college_booking
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="openid != null" >
+                openid,
+            </if>
+            <if test="name != null" >
+                `name`,
+            </if>
+            <if test="phone != null" >
+                `phone`,
+            </if>
+            <if test="date != null" >
+                `date`,
+            </if>
+            <if test="duedate != null" >
+                `duedate`,
+            </if>
+            <if test="college_code != null" >
+                `college_code`,
+            </if>
+            <if test="b_count != null" >
+                `b_count`,
+            </if>
+            <if test="b_time != null" >
+                `b_time`
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="openid != null" >
+                #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="name != null" >
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="phone != null" >
+                #{phone,jdbcType=VARCHAR},
+            </if>
+            <if test="date != null" >
+                #{date,jdbcType=DATE},
+            </if>
+            <if test="duedate != null" >
+                #{duedate,jdbcType=DATE},
+            </if>
+            <if test="college_code != null" >
+                #{college_code,jdbcType=DATE},
+            </if>
+            <if test="b_count != null" >
+                #{b_count,jdbcType=INTEGER},
+            </if>
+            <if test="b_time != null" >
+                #{b_time,jdbcType=INTEGER}
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeBooking" >
+        update college_booking
+        <set >
+            <if test="openid != null" >
+                openid = #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="name != null" >
+                `name` = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="phone != null" >
+                `phone` = #{phone,jdbcType=VARCHAR},
+            </if>
+            <if test="date != null" >
+                `date` = #{date ,jdbcType=DATE},
+            </if>
+            <if test="duedate != null" >
+                duedate = #{duedate ,jdbcType=DATE},
+            </if>
+            <if test="college_code != null" >
+                college_code = #{college_code ,jdbcType=VARCHAR},
+            </if>
+            <if test="b_count != null" >
+                b_count = #{b_count ,jdbcType=INTEGER},
+            </if>
+            <if test="b_time != null" >
+                b_time = #{b_time,jdbcType=INTEGER}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+</mapper>

+ 21 - 5
src/main/resources/mybatis/mapper/college/CollegeCurriculumCoreMapper.xml

@@ -49,7 +49,9 @@
             ccc.c_desc,
             ccc.isvideo,
             ccc.istest,
-            (select result from college_test_detail where id = ccc.testid and openid = #{openid,jdbcType=VARCHAR}) test_result,
+            ccc.testid,
+            ccc.id,
+            (select result from college_test_detail where coreid = ccc.id and openid = #{openid,jdbcType=VARCHAR}) result,
             (select status from college_learning_detail where c_code = ccc.c_code  and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `status`,
             (select rate from college_learning_detail where c_code = ccc.c_code  and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `rate`
         FROM
@@ -128,12 +130,13 @@
     <select id="queryCoreByStep" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumCore"
             parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumCore">
         select
-        *
-        from college_curriculum_core
+        ccc.*,
+        IFNULL((select `status` from college_learning_detail where c_code = ccc.c_code  and open_id = #{openid,jdbcType=VARCHAR}  and `status` != 8 order by `status` desc limit 1),0) `status`
+        from college_curriculum_core as ccc
         where
-            FIND_IN_SET(#{c_step,jdbcType=VARCHAR},c_step) >0
+            FIND_IN_SET(#{c_step,jdbcType=VARCHAR},ccc.c_step) >0
         and
-            c_type = #{c_type,jdbcType=VARCHAR}
+            ccc.c_type = #{c_type,jdbcType=VARCHAR}
         order by id desc
     </select>
 
@@ -146,6 +149,14 @@
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+    <select id="queryCoreByCode" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumCore"
+            parameterType="java.lang.String">
+        select
+        *
+        from college_curriculum_core
+        where c_code = #{c_code,jdbcType=INTEGER}
+    </select>
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from college_curriculum_core
         where id = #{id,jdbcType=INTEGER}
@@ -283,6 +294,11 @@
         </trim>
     </insert>
 
+    <update id="updatePositive" parameterType="java.lang.String">
+        update college_curriculum_core set positive = positive +1
+        where c_code =  #{c_code,jdbcType=VARCHAR}
+    </update>
+
     <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumCore">
         update college_curriculum_core
         <set>

+ 31 - 8
src/main/resources/mybatis/mapper/college/CollegeCurriculumExperienceMapper.xml

@@ -18,6 +18,7 @@
         <result column="longitude" property="longitude" jdbcType="VARCHAR" />
         <result column="credit" property="credit" jdbcType="INTEGER" />
         <result column="qrcode" property="qrcode" jdbcType="VARCHAR" />
+        <result column="img_href" property="img_href" jdbcType="VARCHAR" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -30,22 +31,35 @@
 
     <select id="queryExperienceByStep" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumExperience" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumExperience">
         select
-        *
-        from college_curriculum_experience
+        cce.*,
+        IFNULL((select `status` from college_learning_detail where c_code = cce.c_code  and open_id = #{openid,jdbcType=VARCHAR}  order by `status` desc limit 1),0) `status`
+        from college_curriculum_experience as cce
         where 1=1
         <if test="c_step != null and c_step != ''">
-            and FIND_IN_SET(#{c_step,jdbcType=VARCHAR},c_step) >0
+            and FIND_IN_SET(#{c_step,jdbcType=VARCHAR},cce.c_step) >0
         </if>
         <if test="c_type != null and c_type != ''">
-            and c_type = #{c_type,jdbcType=VARCHAR}
+            and cce.c_type = #{c_type,jdbcType=VARCHAR}
         </if>
         <if test="city != null and city != ''">
-            and city = #{city,jdbcType=VARCHAR}
+            and cce.city = #{city,jdbcType=VARCHAR}
         </if>
         order by id desc
     </select>
 
 
+    <select id="queryExperienceDetail" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumExperience" parameterType="com.ygj.yuemum.domain.college.CollegeQuery" >
+        SELECT
+            cce.* ,
+            (select id from college_booking where phone = #{phone,jdbcType=VARCHAR} and college_code = cce.c_code ) bookingid,
+            (select status from college_learning_detail where open_id =  #{openid,jdbcType=VARCHAR} and college_learning_detail.c_code  = cce.c_code order by id desc limit 1 ) learningStatus
+        FROM
+            college_curriculum_experience as cce
+        where
+            c_code = #{c_code,jdbcType=VARCHAR}
+    </select>
+
+
     <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumExperience" parameterType="java.lang.Integer" >
         select
         *
@@ -101,7 +115,10 @@
                 credit,
             </if>
             <if test="qrcode != null" >
-                qrcode
+                qrcode,
+            </if>
+            <if test="img_href != null" >
+                img_href
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -145,7 +162,10 @@
                 #{credit,jdbcType=INTEGER},
             </if>
             <if test="qrcode != null" >
-                #{qrcode,jdbcType=VARCHAR}
+                #{qrcode,jdbcType=VARCHAR},
+            </if>
+            <if test="img_href != null" >
+                #{img_href,jdbcType=VARCHAR}
             </if>
         </trim>
     </insert>
@@ -216,7 +236,10 @@
                 credit = #{credit,jdbcType=INTEGER},
             </if>
             <if test="qrcode != null" >
-                qrcode = #{qrcode,jdbcType=VARCHAR}
+                qrcode = #{qrcode,jdbcType=VARCHAR},
+            </if>
+            <if test="img_href != null" >
+                img_href = #{img_href,jdbcType=VARCHAR}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 34 - 10
src/main/resources/mybatis/mapper/college/CollegeCurriculumPracticeMapper.xml

@@ -21,6 +21,7 @@
         <result column="pcount" property="pcount" jdbcType="INTEGER" />
         <result column="credit" property="credit" jdbcType="INTEGER" />
         <result column="qrcode" property="qrcode" jdbcType="VARCHAR" />
+        <result column="img_href" property="img_href" jdbcType="VARCHAR" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -56,23 +57,24 @@
 
     <select id="queryPracticeByStep" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumPractice" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumPractice">
         select
-        *
-        from college_curriculum_practice
+        ccp.*,
+        IFNULL((select `status` from college_learning_detail where c_code = ccp.c_code  and open_id = #{openid,jdbcType=VARCHAR}  order by `status` desc limit 1),0) `status`
+        from college_curriculum_practice as ccp
         where 1=1
         <if test="c_step != null and c_step != ''">
-            and FIND_IN_SET(#{c_step,jdbcType=VARCHAR},c_step) >0
+            and FIND_IN_SET(#{c_step,jdbcType=VARCHAR},ccp.c_step) >0
         </if>
         <if test="c_type != null and c_type != ''">
-            and c_type = #{c_type,jdbcType=VARCHAR}
+            and ccp.c_type = #{c_type,jdbcType=VARCHAR}
         </if>
         <if test="city != null and city != ''">
-            and city = #{city,jdbcType=VARCHAR}
+            and ccp.city = #{city,jdbcType=VARCHAR}
         </if>
         <if test="startdate != null and startdate != ''">
-            and DATE_FORMAT(#{startdate,jdbcType=DATE},'%Y-%m-%d') BETWEEN startdate AND  enddate
+            and DATE_FORMAT(#{startdate,jdbcType=DATE},'%Y-%m-%d') BETWEEN ccp.startdate AND  ccp.enddate
         </if>
         <if test="deadline != null and deadline != ''">
-            and DATE_FORMAT(deadline,'%Y-%m-%d') &gt;= DATE_FORMAT(#{deadline,jdbcType=DATE},'%Y-%m-%d')
+            and DATE_FORMAT(ccp.deadline,'%Y-%m-%d') &gt;= DATE_FORMAT(#{deadline,jdbcType=DATE},'%Y-%m-%d')
         </if>
         order by id desc
     </select>
@@ -85,11 +87,24 @@
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+
+    <select id="queryPracticeDetail" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumPractice" parameterType="com.ygj.yuemum.domain.college.CollegeQuery" >
+        SELECT
+            ccp.* ,
+            (select id from college_booking where phone = #{phone,jdbcType=VARCHAR} and college_code = ccp.c_code ) bookingid,
+            (select status from college_learning_detail where open_id =  #{openid,jdbcType=VARCHAR} and college_learning_detail.c_code  = ccp.c_code order by id desc limit 1 ) learningStatus
+        FROM
+            college_curriculum_practice  ccp
+        where
+            c_code = #{c_code,jdbcType=VARCHAR}
+    </select>
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
         delete from college_curriculum_practice
         where id = #{id,jdbcType=INTEGER}
     </delete>
 
+
     <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumPractice" >
         insert into college_curriculum_practice
         <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -142,7 +157,10 @@
                 credit,
             </if>
             <if test="qrcode != null" >
-                qrcode
+                qrcode,
+            </if>
+            <if test="img_href != null" >
+                img_href
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -195,7 +213,10 @@
                 #{credit,jdbcType=INTEGER},
             </if>
             <if test="qrcode != null" >
-                #{qrcode,jdbcType=VARCHAR}
+                #{qrcode,jdbcType=VARCHAR},
+            </if>
+            <if test="img_href != null" >
+                #{img_href,jdbcType=VARCHAR}
             </if>
         </trim>
     </insert>
@@ -252,7 +273,10 @@
                 credit = #{credit,jdbcType=INTEGER},
             </if>
             <if test="qrcode != null" >
-                qrcode = #{qrcode,jdbcType=VARCHAR}
+                qrcode = #{qrcode,jdbcType=VARCHAR},
+            </if>
+            <if test="img_href != null" >
+                img_href = #{img_href,jdbcType=VARCHAR}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 30 - 3
src/main/resources/mybatis/mapper/college/CollegeLearningDetailMapper.xml

@@ -9,7 +9,7 @@
         <result column="status" property="status" jdbcType="INTEGER" />
         <result column="date" property="date" jdbcType="VARCHAR" />
         <result column="credit" property="credit" jdbcType="INTEGER" />
-        <result column="rate" property="rate" jdbcType="INTEGER" />
+        <result column="rate" property="rate" jdbcType="DECIMAL" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -28,6 +28,25 @@
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+    <select id="checkCorePositive" resultType="com.ygj.yuemum.domain.college.CollegeLearningDetail" parameterType="com.ygj.yuemum.domain.college.CollegeLearningDetail" >
+        select
+        *
+        from college_learning_detail
+        where open_id = #{open_id,jdbcType=INTEGER}
+        and c_code = #{c_code,jdbcType=INTEGER}
+        and status = 8
+    </select>
+
+    <select id="checkCoreLearningRate" resultType="com.ygj.yuemum.domain.college.CollegeLearningDetail" parameterType="com.ygj.yuemum.domain.college.CollegeLearningDetail" >
+        select
+        *
+        from college_learning_detail
+        where open_id = #{open_id,jdbcType=INTEGER}
+        and c_code = #{c_code,jdbcType=INTEGER}
+        order by id desc limit 1
+    </select>
+
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
         delete from college_learning_detail
         where id = #{id,jdbcType=INTEGER}
@@ -72,7 +91,7 @@
                 #{credit,jdbcType=INTEGER},
             </if>
             <if test="rate != null" >
-                #{rate,jdbcType=INTEGER}
+                #{rate,jdbcType=DECIMAL}
             </if>
         </trim>
     </insert>
@@ -96,10 +115,18 @@
                 credit = #{credit,jdbcType=INTEGER},
             </if>
             <if test="rate != null" >
-                rate = #{rate,jdbcType=INTEGER}
+                rate = #{rate,jdbcType=DECIMAL}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
 
+    <update id="updateLearningRate" parameterType="com.ygj.yuemum.domain.college.CollegeLearningDetail" >
+        update college_learning_detail
+        set rate = #{rate,jdbcType=DECIMAL}
+        where  open_id = #{open_id,jdbcType=VARCHAR}
+        and  c_code = #{c_code,jdbcType=VARCHAR}
+    </update>
+
+
 </mapper>

+ 38 - 10
src/main/resources/mybatis/mapper/college/CollegeTestDetailMapper.xml

@@ -5,9 +5,10 @@
     <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegeTestDetail" >
         <id column="id" property="id" jdbcType="INTEGER" />
         <result column="openid" property="openid" jdbcType="VARCHAR" />
-        <result column="testid" property="testid" jdbcType="INTEGER" />
+        <result column="coreid" property="coreid" jdbcType="INTEGER" />
         <result column="status" property="status" jdbcType="INTEGER" />
         <result column="result" property="result" jdbcType="INTEGER" />
+        <result column="answers" property="answers" jdbcType="VARCHAR" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -19,6 +20,16 @@
     </select>
 
 
+    <select id="queryUserAnswers" resultType="com.ygj.yuemum.domain.college.CollegeTestDetail" parameterType="com.ygj.yuemum.domain.college.CollegeTestDetail" >
+        select
+        *
+        from college_test_detail
+        where openid = #{openid,jdbcType=VARCHAR}
+        and coreid = #{coreid,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
+
     <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeTestDetail" parameterType="java.lang.Integer" >
         select
         *
@@ -26,6 +37,14 @@
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+    <select id="selectByOpenId" resultType="com.ygj.yuemum.domain.college.CollegeTestDetail" parameterType="com.ygj.yuemum.domain.college.CollegeTestDetail" >
+        select
+        *
+        from college_test_detail
+        where openid = #{openid,jdbcType=INTEGER}
+        and coreid = #{coreid,jdbcType=VARCHAR}
+    </select>
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
         delete from college_test_detail
         where id = #{id,jdbcType=INTEGER}
@@ -37,28 +56,34 @@
             <if test="openid != null" >
                 openid,
             </if>
-            <if test="testid != null" >
-                testid,
+            <if test="coreid != null" >
+                coreid,
             </if>
             <if test="status != null" >
                 status,
             </if>
             <if test="result != null" >
-                result
+                result,
+            </if>
+            <if test="answers != null" >
+                answers
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
             <if test="openid != null" >
                 #{openid,jdbcType=VARCHAR},
             </if>
-            <if test="testid != null" >
-                #{testid,jdbcType=INTEGER},
+            <if test="coreid != null" >
+                #{coreid,jdbcType=INTEGER},
             </if>
             <if test="status != null" >
                 #{status,jdbcType=INTEGER},
             </if>
             <if test="result != null" >
-                #{result,jdbcType=INTEGER}
+                #{result,jdbcType=INTEGER},
+            </if>
+            <if test="answers != null" >
+                #{answers,jdbcType=INTEGER}
             </if>
         </trim>
     </insert>
@@ -69,14 +94,17 @@
             <if test="openid != null" >
                 openid = #{openid,jdbcType=VARCHAR},
             </if>
-            <if test="testid != null" >
-                testid = #{testid,jdbcType=INTEGER},
+            <if test="coreid != null" >
+                coreid = #{coreid,jdbcType=INTEGER},
             </if>
             <if test="status != null" >
                 status = #{status ,jdbcType=INTEGER},
             </if>
             <if test="result != null" >
-                result = #{result,jdbcType=INTEGER}
+                result = #{result,jdbcType=INTEGER},
+            </if>
+            <if test="answers != null" >
+                answers = #{answers,jdbcType=INTEGER}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 22 - 13
src/main/resources/mybatis/mapper/college/CollegeTestMapper.xml

@@ -7,8 +7,8 @@
         <result column="core_id" property="core_id" jdbcType="VARCHAR" />
         <result column="name" property="name" jdbcType="VARCHAR" />
         <result column="score" property="score" jdbcType="INTEGER" />
-        <result column="credit" property="credit" jdbcType="INTEGER" />
         <result column="desc" property="desc" jdbcType="VARCHAR" />
+        <result column="comment" property="comment" jdbcType="VARCHAR" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -27,6 +27,15 @@
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+
+    <select id="selectByCoreId" resultType="com.ygj.yuemum.domain.college.CollegeTest" parameterType="java.lang.Integer" >
+        select
+        *
+        from college_test
+        where core_id = #{core_id,jdbcType=INTEGER}
+        order by seq asc
+    </select>
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
         delete from college_test
         where id = #{id,jdbcType=INTEGER}
@@ -44,11 +53,11 @@
             <if test="score != null" >
                 score,
             </if>
-            <if test="credit != null" >
-                credit,
-            </if>
             <if test="desc != null" >
-                `desc`
+                `desc`,
+            </if>
+            <if test="comment != null" >
+                `comment`
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -61,11 +70,11 @@
             <if test="score != null" >
                 #{score,jdbcType=INTEGER},
             </if>
-            <if test="credit != null" >
-                #{credit,jdbcType=INTEGER},
-            </if>
             <if test="desc != null" >
-                #{desc,jdbcType=VARCHAR}
+                #{desc,jdbcType=VARCHAR},
+            </if>
+            <if test="comment != null" >
+                #{comment,jdbcType=VARCHAR}
             </if>
         </trim>
     </insert>
@@ -82,11 +91,11 @@
             <if test="score != null" >
                 score = #{score ,jdbcType=INTEGER},
             </if>
-            <if test="credit != null" >
-                credit = #{credit,jdbcType=INTEGER},
-            </if>
             <if test="desc != null" >
-                `desc` = #{desc,jdbcType=VARCHAR}
+                `desc` = #{desc,jdbcType=VARCHAR},
+            </if>
+            <if test="comment != null" >
+                `comment` = #{comment,jdbcType=VARCHAR}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 16 - 18
src/main/resources/mybatis/mapper/college/CollegeTestResultMapper.xml

@@ -8,14 +8,13 @@
         <result column="seq" property="seq" jdbcType="INTEGER" />
         <result column="result_desc" property="result_desc" jdbcType="INTEGER" />
         <result column="isright" property="isright" jdbcType="INTEGER" />
-        <result column="score" property="score" jdbcType="INTEGER" />
     </resultMap>
     <!--获取所有数据-->
 
     <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegeTestResult" >
         select
         *
-        from college_test_detail
+        from college_test_result
         order by id desc
     </select>
 
@@ -23,17 +22,25 @@
     <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeTestResult" parameterType="java.lang.Integer" >
         select
         *
-        from college_test_detail
+        from college_test_result
         where id = #{id,jdbcType=INTEGER}
     </select>
 
+    <select id="selectByTestId" resultType="com.ygj.yuemum.domain.college.CollegeTestResult" parameterType="java.lang.Integer" >
+        select
+        *
+        from college_test_result
+        where testid = #{testid,jdbcType=INTEGER}
+        order by seq asc
+    </select>
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
-        delete from college_test_detail
+        delete from college_test_result
         where id = #{id,jdbcType=INTEGER}
     </delete>
 
     <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeTestResult" >
-        insert into college_test_detail
+        insert into college_test_result
         <trim prefix="(" suffix=")" suffixOverrides="," >
             <if test="testid != null" >
                 testid,
@@ -45,10 +52,7 @@
                 result_desc,
             </if>
             <if test="isright != null" >
-                isright,
-            </if>
-            <if test="score != null" >
-                score
+                isright
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -62,16 +66,13 @@
                 #{result_desc,jdbcType=VARCHAR},
             </if>
             <if test="isright != null" >
-                #{isright,jdbcType=INTEGER},
-            </if>
-            <if test="score != null" >
-                #{score,jdbcType=INTEGER}
+                #{isright,jdbcType=INTEGER}
             </if>
         </trim>
     </insert>
 
     <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeTestResult" >
-        update college_test_detail
+        update college_test_result
         <set >
             <if test="testid != null" >
                 testid = #{testid,jdbcType=INTEGER},
@@ -83,10 +84,7 @@
                 result_desc = #{result_desc ,jdbcType=VARCHAR},
             </if>
             <if test="isright != null" >
-                isright = #{isright,jdbcType=INTEGER},
-            </if>
-            <if test="score != null" >
-                score = #{score,jdbcType=INTEGER}
+                isright = #{isright,jdbcType=INTEGER}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 7 - 1
src/main/resources/mybatis/mapper/college/CollegeUserPointsMapper.xml

@@ -26,7 +26,7 @@
     </select>
 
 
-    <select id="queryUserPoints" resultType="com.ygj.yuemum.domain.college.CollegeUserPoints" parameterType="java.lang.String" >
+    <select id="queryOneUserPoints" resultType="com.ygj.yuemum.domain.college.CollegeUserPoints" parameterType="java.lang.String" >
         select
         *
         from college_user_points
@@ -80,4 +80,10 @@
         where id = #{id,jdbcType=INTEGER}
     </update>
 
+
+    <update id="updatePointsByTest"  parameterType="java.lang.String" >
+        update college_user_points set credit_total = credit_total + 1, credit_available = credit_available + 1
+        where openid = #{openid,jdbcType=VARCHAR}
+    </update>
+
 </mapper>