Jelajahi Sumber

奖学金开发

huan.wang@yueguanjia.com 5 tahun lalu
induk
melakukan
fb318e7446
49 mengubah file dengan 2094 tambahan dan 163 penghapusan
  1. 5 5
      pom.xml
  2. 5 2
      src/main/java/com/ygj/yuemum/component/Constant.java
  3. 43 0
      src/main/java/com/ygj/yuemum/controller/college/CollegeCouponCreditController.java
  4. 0 43
      src/main/java/com/ygj/yuemum/controller/college/CollegeCouponRuleController.java
  5. 42 0
      src/main/java/com/ygj/yuemum/controller/college/CollegeScholarshipsDetailController.java
  6. 32 1
      src/main/java/com/ygj/yuemum/controller/college/CollegeUserPointsController.java
  7. 22 0
      src/main/java/com/ygj/yuemum/dao/college/CollegePresentCreditDao.java
  8. 0 22
      src/main/java/com/ygj/yuemum/dao/college/CollegePresentRuleDao.java
  9. 23 0
      src/main/java/com/ygj/yuemum/dao/college/CollegePresentScholarshipsDao.java
  10. 21 0
      src/main/java/com/ygj/yuemum/dao/college/CollegePresentScholarshipsLogsDao.java
  11. 26 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeScholarshipsDetailDao.java
  12. 22 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeScholarshipsRuleDao.java
  13. 9 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeUserLevelDao.java
  14. 3 0
      src/main/java/com/ygj/yuemum/dao/college/CollegeUserPointsDao.java
  15. 9 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumCore.java
  16. 10 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumExperience.java
  17. 11 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeCurriculumPractice.java
  18. 1 1
      src/main/java/com/ygj/yuemum/domain/college/CollegePresentRule.java
  19. 122 0
      src/main/java/com/ygj/yuemum/domain/college/CollegePresentScholarships.java
  20. 105 0
      src/main/java/com/ygj/yuemum/domain/college/CollegePresentScholarshipsLogs.java
  21. 104 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeScholarshipsDetail.java
  22. 59 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeScholarshipsRule.java
  23. 40 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeUserLevel.java
  24. 18 0
      src/main/java/com/ygj/yuemum/domain/college/CollegeUserPoints.java
  25. 9 0
      src/main/java/com/ygj/yuemum/domain/college/ReturnUserLearningCoreDetail.java
  26. 66 1
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumCoreService.java
  27. 32 6
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumExperienceService.java
  28. 38 0
      src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumPracticeService.java
  29. 42 0
      src/main/java/com/ygj/yuemum/service/college/CollegePresentCreditService.java
  30. 0 42
      src/main/java/com/ygj/yuemum/service/college/CollegePresentRuleService.java
  31. 39 0
      src/main/java/com/ygj/yuemum/service/college/CollegePresentScholarshipsLogsService.java
  32. 40 0
      src/main/java/com/ygj/yuemum/service/college/CollegePresentScholarshipsService.java
  33. 233 0
      src/main/java/com/ygj/yuemum/service/college/CollegeScholarshipsDetailService.java
  34. 18 0
      src/main/java/com/ygj/yuemum/service/college/CollegeScholarshipsRuleService.java
  35. 5 0
      src/main/java/com/ygj/yuemum/service/college/CollegeTestDetailService.java
  36. 21 0
      src/main/java/com/ygj/yuemum/service/college/CollegeUserLevelService.java
  37. 187 16
      src/main/java/com/ygj/yuemum/service/college/CollegeUserPointsService.java
  38. 13 1
      src/main/java/com/ygj/yuemum/service/coupon/CouponCreateService.java
  39. 9 0
      src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java
  40. 1 0
      src/main/resources/application.yml
  41. 4 5
      src/main/resources/mybatis/mapper/college/CollegeCurriculumCoreMapper.xml
  42. 13 13
      src/main/resources/mybatis/mapper/college/CollegePresentRuleMapper.xml
  43. 125 0
      src/main/resources/mybatis/mapper/college/CollegePresentScholarshipsLogsMapper.xml
  44. 151 0
      src/main/resources/mybatis/mapper/college/CollegePresentScholarshipsMapper.xml
  45. 176 0
      src/main/resources/mybatis/mapper/college/CollegeScholarshipsDetailMapper.xml
  46. 85 0
      src/main/resources/mybatis/mapper/college/CollegeScholarshipsRuleMapper.xml
  47. 24 0
      src/main/resources/mybatis/mapper/college/CollegeUserLevelMapper.xml
  48. 31 3
      src/main/resources/mybatis/mapper/college/CollegeUserPointsMapper.xml
  49. 0 2
      src/main/resources/mybatis/mapper/wxmini/WXPublicMapper.xml

+ 5 - 5
pom.xml

@@ -71,11 +71,11 @@
             <version>2.8.2</version>
         </dependency>
         <!--启动-->
-        <!--<dependency>-->
-        <!--<groupId>org.springframework.boot</groupId>-->
-        <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
-        <!--<scope>provided</scope>-->
-        <!--</dependency>-->
+<!--        <dependency>-->
+<!--        <groupId>org.springframework.boot</groupId>-->
+<!--        <artifactId>spring-boot-starter-tomcat</artifactId>-->
+<!--        <scope>provided</scope>-->
+<!--        </dependency>-->
 
 
         <dependency>

+ 5 - 2
src/main/java/com/ygj/yuemum/component/Constant.java

@@ -63,6 +63,7 @@ public class Constant {
     public static String HTTPDIANPINGIMGURL;
     public static Integer LMP;
     public static Integer AGE;
+    public static Integer MAXSCHOLARSHIPS;
 
     //注入
     @Autowired(required = false)
@@ -299,6 +300,8 @@ public class Constant {
         Constant.AGE = AGE;
     }
 
-
-
+    @Autowired(required = false)
+    public void getMAXSCHOLARSHIPS(@Value("${college.MAXSCHOLARSHIPS}") Integer MAXSCHOLARSHIPS) {
+        Constant.MAXSCHOLARSHIPS = MAXSCHOLARSHIPS;
+    }
 }

+ 43 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeCouponCreditController.java

@@ -0,0 +1,43 @@
+package com.ygj.yuemum.controller.college;
+
+
+import com.ygj.yuemum.domain.college.CollegePresentCredit;
+import com.ygj.yuemum.service.college.CollegePresentCreditService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+public class CollegeCouponCreditController {
+
+    @Autowired
+    private CollegePresentCreditService collegePresentCreditService;
+
+    @GetMapping("/getCollegePresentCredits")
+    public List<CollegePresentCredit> getCollegePresentCredits() {
+        return collegePresentCreditService.getCollegePresentCredits();
+    }
+
+    @GetMapping("/getCollegePresentCredit")
+    public CollegePresentCredit getCollegePresentCredit(@RequestParam("id") Integer id) {
+        return collegePresentCreditService.getCollegePresentCredit(id);
+    }
+
+    @PostMapping("/addCollegePresentCredit")
+    public int addCollegePresentCredit(@ModelAttribute CollegePresentCredit collegePresentCredit) {
+        return collegePresentCreditService.addCollegePresentCredit(collegePresentCredit);
+    }
+
+    @GetMapping("/deleteCollegePresentCredit")
+    public int deleteCollegePresentCredit(@RequestParam("id") Integer id) {
+        return collegePresentCreditService.deleteCollegePresentCredit(id);
+    }
+
+    @PostMapping("/updateCollegePresentCredit")
+    public int updateCollegePresentCredit(@ModelAttribute CollegePresentCredit collegePresentCredit) {
+        return collegePresentCreditService.updateCollegePresentCredit(collegePresentCredit);
+    }
+
+
+}

+ 0 - 43
src/main/java/com/ygj/yuemum/controller/college/CollegeCouponRuleController.java

@@ -1,43 +0,0 @@
-package com.ygj.yuemum.controller.college;
-
-
-import com.ygj.yuemum.domain.college.CollegePresentRule;
-import com.ygj.yuemum.service.college.CollegePresentRuleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-public class CollegeCouponRuleController {
-
-    @Autowired
-    private CollegePresentRuleService collegePresentRuleService;
-
-    @GetMapping("/getCollegePresentRules")
-    public List<CollegePresentRule> getCollegePresentRules() {
-        return collegePresentRuleService.getCollegePresentRules();
-    }
-
-    @GetMapping("/getCollegePresentRule")
-    public CollegePresentRule getCollegePresentRule(@RequestParam("id") Integer id) {
-        return collegePresentRuleService.getCollegePresentRule(id);
-    }
-
-    @PostMapping("/addCollegePresentRule")
-    public int addCollegePresentRule(@ModelAttribute CollegePresentRule collegePresentRule) {
-        return collegePresentRuleService.addCollegePresentRule(collegePresentRule);
-    }
-
-    @GetMapping("/deleteCollegePresentRule")
-    public int deleteCollegePresentRule(@RequestParam("id") Integer id) {
-        return collegePresentRuleService.deleteCollegePresentRule(id);
-    }
-
-    @PostMapping("/updateCollegePresentRule")
-    public int updateCollegePresentRule(@ModelAttribute CollegePresentRule collegePresentRule) {
-        return collegePresentRuleService.updateCollegePresentRule(collegePresentRule);
-    }
-
-
-}

+ 42 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeScholarshipsDetailController.java

@@ -0,0 +1,42 @@
+package com.ygj.yuemum.controller.college;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ygj.yuemum.domain.college.CollegeLearningDetail;
+import com.ygj.yuemum.domain.college.CollegeScholarshipsDetail;
+import com.ygj.yuemum.service.college.CollegeLearningDetailService;
+import com.ygj.yuemum.service.college.CollegeScholarshipsDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@RestController
+public class CollegeScholarshipsDetailController {
+
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
+
+
+    @PostMapping("/college/addScholarships")
+    public int addScholarships(@RequestParam("openid") String openid,
+                               @RequestParam("type") String type,
+                               @RequestParam("college_type") String college_type,
+                               @RequestParam("college_id") Integer college_id,
+                               @RequestParam("credit") Integer credit,
+                               @RequestParam("testResult") Integer testResult) {
+        return collegeScholarshipsDetailService.addScholarships(openid, type,college_type, college_id, credit, testResult);
+    }
+
+
+    @PostMapping("/college/queryUserScholarshipsLog") //++++++
+    public String queryUserScholarshipsLog(@RequestParam("openid") String openid) {
+        List<Object> orderTemps = collegeScholarshipsDetailService.queryUserScholarshipsLog(openid);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+
+}

+ 32 - 1
src/main/java/com/ygj/yuemum/controller/college/CollegeUserPointsController.java

@@ -3,6 +3,7 @@ package com.ygj.yuemum.controller.college;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs;
 import com.ygj.yuemum.domain.college.CollegeUserPoints;
 import com.ygj.yuemum.service.college.CollegeUserPointsService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,11 +45,41 @@ public class CollegeUserPointsController {
 
     @PostMapping("/college/queryUserPoints")
     public String QueryUserPoints(@RequestParam("openid") String openid, @RequestParam("city") String city) {
-        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.QueryUserPoints(openid, city);
+        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.queryUserPoints(openid, city);
         String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
         return jso;
     }
 
+    @PostMapping("/college/queryRedeemIndex") //++++++
+    public String queryRedeemIndex(@RequestParam("openid") String openid) {
+        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.queryRedeemIndex(openid);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+    @PostMapping("/college/queryRedeem") //++++++
+    public String queryRedeem(@RequestParam("presentId")Integer presentId) {
+        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.queryRedeem(presentId);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+    @PostMapping("/college/queryRedeemDetail") //++++++
+    public String queryRedeemDetail(@RequestParam("presentId")Integer presentId,@RequestParam("openid") String openid) {
+        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.queryRedeemDetail(presentId,openid);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+
+    @PostMapping("/college/userRedeem") //++++++
+    public String userRedeem(@ModelAttribute CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) {
+        LinkedHashMap<String, Object> orderTemps = collegeUserPointsService.userRedeem(collegePresentScholarshipsLogs);
+        String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
+        return jso;
+    }
+
+
     @PostMapping("/college/getPointsByOffline")
     public int getPointsByOffline(@RequestParam("openid") String openid, @RequestParam("c_code") String c_code, @RequestParam("lat") String lat, @RequestParam("lon") String lon) {
         return collegeUserPointsService.getPointsByOffline(openid, c_code, lat, lon);

+ 22 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegePresentCreditDao.java

@@ -0,0 +1,22 @@
+package com.ygj.yuemum.dao.college;
+
+import com.ygj.yuemum.domain.college.CollegePresentCredit;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CollegePresentCreditDao {
+
+    List<CollegePresentCredit> getAll();
+
+    CollegePresentCredit selectByPrimaryKey(Integer id);
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CollegePresentCredit record);
+
+    int updateByPrimaryKeySelective(CollegePresentCredit record);
+
+    List<CollegePresentCredit> queryUserReceived(String openid);
+}

+ 0 - 22
src/main/java/com/ygj/yuemum/dao/college/CollegePresentRuleDao.java

@@ -1,22 +0,0 @@
-package com.ygj.yuemum.dao.college;
-
-import com.ygj.yuemum.domain.college.CollegePresentRule;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface CollegePresentRuleDao {
-
-    List<CollegePresentRule> getAll();
-
-    CollegePresentRule selectByPrimaryKey(Integer id);
-
-    int deleteByPrimaryKey(Integer id);
-
-    int insertSelective(CollegePresentRule record);
-
-    int updateByPrimaryKeySelective(CollegePresentRule record);
-
-    List<CollegePresentRule> queryUserReceived(String openid);
-}

+ 23 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegePresentScholarshipsDao.java

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

+ 21 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegePresentScholarshipsLogsDao.java

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

+ 26 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeScholarshipsDetailDao.java

@@ -0,0 +1,26 @@
+package com.ygj.yuemum.dao.college;
+
+import com.ygj.yuemum.domain.college.CollegeScholarshipsDetail;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CollegeScholarshipsDetailDao {
+
+    List<CollegeScholarshipsDetail> getAll();
+
+    CollegeScholarshipsDetail selectByPrimaryKey(Integer id);
+
+    CollegeScholarshipsDetail queryCollegeScholarships(CollegeScholarshipsDetail collegeScholarshipsDetail);
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CollegeScholarshipsDetail record);
+
+    int updateByPrimaryKeySelective(CollegeScholarshipsDetail record);
+
+    int checkFirst(CollegeScholarshipsDetail record);
+
+    List<CollegeScholarshipsDetail> queryUserScholarshipsLog(String openid);
+}

+ 22 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeScholarshipsRuleDao.java

@@ -0,0 +1,22 @@
+package com.ygj.yuemum.dao.college;
+
+import com.ygj.yuemum.domain.college.CollegeScholarshipsRule;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CollegeScholarshipsRuleDao {
+
+    List<CollegeScholarshipsRule> getAll();
+
+    CollegeScholarshipsRule selectByPrimaryKey(Integer id);
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CollegeScholarshipsRule record);
+
+    int updateByPrimaryKeySelective(CollegeScholarshipsRule record);
+
+    CollegeScholarshipsRule getScholarshipsRule(String type);
+}

+ 9 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeUserLevelDao.java

@@ -0,0 +1,9 @@
+package com.ygj.yuemum.dao.college;
+
+import com.ygj.yuemum.domain.college.CollegeUserLevel;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CollegeUserLevelDao {
+    CollegeUserLevel getUserLevel(Integer credit);
+}

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

@@ -1,6 +1,7 @@
 package com.ygj.yuemum.dao.college;
 
 import com.ygj.yuemum.domain.college.CollegePointsDetail;
+import com.ygj.yuemum.domain.college.CollegeScholarshipsDetail;
 import com.ygj.yuemum.domain.college.CollegeUserPoints;
 import org.springframework.stereotype.Repository;
 
@@ -22,4 +23,6 @@ public interface CollegeUserPointsDao {
     int updateByPrimaryKeySelective(CollegeUserPoints record);
 
     int updatePointsByTest(CollegePointsDetail collegePointsDetail);
+
+    int updateScholarships(CollegeUserPoints collegeUserPoints);
 }

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

@@ -28,10 +28,19 @@ public class CollegeCurriculumCore {
     private String cd_code;
     private String status;
     private String openid;
+    private String scholarships;
     private Integer isbooking;
     private Integer page;
     private Integer limit;
 
+    public String getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(String scholarships) {
+        this.scholarships = scholarships;
+    }
+
     public String getImg_list_href() {
         return img_list_href;
     }

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

@@ -15,6 +15,7 @@ public class CollegeCurriculumExperience {
     private String latitude;
     private String longitude;
     private Integer credit;
+    private String scholarships;
     private String qrcode;
     private String cd_code;
     private String status;
@@ -26,6 +27,15 @@ public class CollegeCurriculumExperience {
     private Integer limit;
     private String img_href;
 
+
+    public String getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(String scholarships) {
+        this.scholarships = scholarships;
+    }
+
     public Integer getPcount() {
         return pcount;
     }

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

@@ -1,5 +1,7 @@
 package com.ygj.yuemum.domain.college;
 
+import org.omg.PortableInterceptor.INACTIVE;
+
 public class CollegeCurriculumPractice {
 
     private Integer id;
@@ -18,6 +20,7 @@ public class CollegeCurriculumPractice {
     private Integer maximum;
     private Integer pcount;
     private Integer credit;
+    private String scholarships;
     private String cd_code;
     private String status;
     private String qrcode;
@@ -30,6 +33,14 @@ public class CollegeCurriculumPractice {
     private Integer limit;
     private String img_href;
 
+    public String getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(String scholarships) {
+        this.scholarships = scholarships;
+    }
+
     public String getMi_latitude() {
         return mi_latitude;
     }

+ 1 - 1
src/main/java/com/ygj/yuemum/domain/college/CollegePresentRule.java

@@ -1,6 +1,6 @@
 package com.ygj.yuemum.domain.college;
 
-public class CollegePresentRule {
+public class CollegePresentCredit {
 
     private Integer id;
     private Integer seq;

+ 122 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegePresentScholarships.java

@@ -0,0 +1,122 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegePresentScholarships {
+
+    private Integer id;
+    private String name;
+    private Integer level;
+    private Integer type;
+    private Integer coupon_id;
+    private Integer scholarships;
+    private String list_img_href;
+    private String detail_img_href;
+    private String redeem_img_href;
+    private Integer postage;
+    private Integer count;
+    private Integer page;
+    private Integer limit;
+
+    public String getRedeem_img_href() {
+        return redeem_img_href;
+    }
+
+    public void setRedeem_img_href(String redeem_img_href) {
+        this.redeem_img_href = redeem_img_href;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getLevel() {
+        return level;
+    }
+
+    public void setLevel(Integer level) {
+        this.level = level;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getCoupon_id() {
+        return coupon_id;
+    }
+
+    public void setCoupon_id(Integer coupon_id) {
+        this.coupon_id = coupon_id;
+    }
+
+    public Integer getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(Integer scholarships) {
+        this.scholarships = scholarships;
+    }
+
+    public String getList_img_href() {
+        return list_img_href;
+    }
+
+    public void setList_img_href(String list_img_href) {
+        this.list_img_href = list_img_href;
+    }
+
+    public String getDetail_img_href() {
+        return detail_img_href;
+    }
+
+    public void setDetail_img_href(String detail_img_href) {
+        this.detail_img_href = detail_img_href;
+    }
+
+    public Integer getPostage() {
+        return postage;
+    }
+
+    public void setPostage(Integer postage) {
+        this.postage = postage;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+}

+ 105 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegePresentScholarshipsLogs.java

@@ -0,0 +1,105 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegePresentScholarshipsLogs {
+
+    private Integer id;
+    private String openid;
+    private Integer present_id;
+    private Integer type;
+    private String create_at;
+    private String collection_date;
+    private Integer mkt_id;
+    private String address;
+    private String coupon_number;
+    private Integer page;
+    private Integer limit;
+
+    public String getCoupon_number() {
+        return coupon_number;
+    }
+
+    public void setCoupon_number(String coupon_number) {
+        this.coupon_number = coupon_number;
+    }
+
+    public String getCollection_date() {
+        return collection_date;
+    }
+
+    public void setCollection_date(String collection_date) {
+        this.collection_date = collection_date;
+    }
+
+    public Integer getMkt_id() {
+        return mkt_id;
+    }
+
+    public void setMkt_id(Integer mkt_id) {
+        this.mkt_id = mkt_id;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    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 Integer getPresent_id() {
+        return present_id;
+    }
+
+    public void setPresent_id(Integer present_id) {
+        this.present_id = present_id;
+    }
+
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getCreate_at() {
+        return create_at;
+    }
+
+    public void setCreate_at(String create_at) {
+        this.create_at = create_at;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+}

+ 104 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeScholarshipsDetail.java

@@ -0,0 +1,104 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegeScholarshipsDetail {
+
+    private Integer id;
+    private String openid;
+    private Integer event_code;
+    private String type;
+    private String college_type;
+    private Integer college_id;
+    private Integer scholarships;
+    private Integer account;
+    private String create_at;
+    private Integer page;
+    private Integer limit;
+
+    public String getCollege_type() {
+        return college_type;
+    }
+
+    public void setCollege_type(String college_type) {
+        this.college_type = college_type;
+    }
+
+    public Integer getAccount() {
+        return account;
+    }
+
+    public void setAccount(Integer account) {
+        this.account = account;
+    }
+
+    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 Integer getEvent_code() {
+        return event_code;
+    }
+
+    public void setEvent_code(Integer event_code) {
+        this.event_code = event_code;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getCollege_id() {
+        return college_id;
+    }
+
+    public void setCollege_id(Integer college_id) {
+        this.college_id = college_id;
+    }
+
+    public Integer getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(Integer scholarships) {
+        this.scholarships = scholarships;
+    }
+
+    public String getCreate_at() {
+        return create_at;
+    }
+
+    public void setCreate_at(String create_at) {
+        this.create_at = create_at;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+}

+ 59 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeScholarshipsRule.java

@@ -0,0 +1,59 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegeScholarshipsRule {
+
+    private Integer id;
+    private String type;
+    private Integer scholarships;
+    private Integer first;
+    private Integer page;
+    private Integer limit;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(Integer scholarships) {
+        this.scholarships = scholarships;
+    }
+
+    public Integer getFirst() {
+        return first;
+    }
+
+    public void setFirst(Integer first) {
+        this.first = first;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+}

+ 40 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeUserLevel.java

@@ -0,0 +1,40 @@
+package com.ygj.yuemum.domain.college;
+
+public class CollegeUserLevel {
+    private Integer id;
+    private Integer level;
+    private Integer start;
+    private Integer end;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getLevel() {
+        return level;
+    }
+
+    public void setLevel(Integer level) {
+        this.level = level;
+    }
+
+    public Integer getStart() {
+        return start;
+    }
+
+    public void setStart(Integer start) {
+        this.start = start;
+    }
+
+    public Integer getEnd() {
+        return end;
+    }
+
+    public void setEnd(Integer end) {
+        this.end = end;
+    }
+}

+ 18 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeUserPoints.java

@@ -6,9 +6,27 @@ public class CollegeUserPoints {
     private String openid;
     private Integer credit_total;
     private Integer credit_available;
+    private Integer scholarships_available;
+    private Integer scholarships_total;
     private Integer page;
     private Integer limit;
 
+    public Integer getScholarships_available() {
+        return scholarships_available;
+    }
+
+    public void setScholarships_available(Integer scholarships_available) {
+        this.scholarships_available = scholarships_available;
+    }
+
+    public Integer getScholarships_total() {
+        return scholarships_total;
+    }
+
+    public void setScholarships_total(Integer scholarships_total) {
+        this.scholarships_total = scholarships_total;
+    }
+
     public Integer getId() {
         return id;
     }

+ 9 - 0
src/main/java/com/ygj/yuemum/domain/college/ReturnUserLearningCoreDetail.java

@@ -6,6 +6,7 @@ public class ReturnUserLearningCoreDetail {
     private Integer c_step;
     private Integer pcount;
     private Integer credit;
+    private Integer scholarships;
     private String t_image_href;
     private String img_head_href;
     private String t_name;
@@ -26,6 +27,14 @@ public class ReturnUserLearningCoreDetail {
     private String rate;
     private String rate_time;
 
+    public Integer getScholarships() {
+        return scholarships;
+    }
+
+    public void setScholarships(Integer scholarships) {
+        this.scholarships = scholarships;
+    }
+
     public Integer getC_step() {
         return c_step;
     }

+ 66 - 1
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumCoreService.java

@@ -29,6 +29,8 @@ public class CollegeCurriculumCoreService {
     private CollegeLearningDetailService collegeLearningDetailService;
     @Autowired
     private CollegeUserPointsService collegeUserPointsService;
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
 
     public List<CollegeCurriculumCore> getCollegeCurriculumCores() {
         List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreDao.getAll();
@@ -84,14 +86,29 @@ public class CollegeCurriculumCoreService {
                     for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
                         if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("core");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumCore.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumCore.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumCore.setScholarships("0-100");
+                            }
                         } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
                             collegeCurriculumCore.setStatus("待完成");
+                            collegeCurriculumCore.setScholarships("0-100");
                         } else {
                             if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
+                                collegeCurriculumCore.setScholarships("0-100");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
                                 collegeCurriculumCore.setCredit(0);
+                                collegeCurriculumCore.setScholarships("0");
                             }
                         }
                         tableData.put("collegeCurriculumCores_b", collegeCurriculumCores);
@@ -103,13 +120,28 @@ public class CollegeCurriculumCoreService {
                     for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCore_p) {
                         if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("core");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumCore.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumCore.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumCore.setScholarships("0-100");
+                            }
                         } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
                             collegeCurriculumCore.setStatus("待完成");
+                            collegeCurriculumCore.setScholarships("0-100");
                         } else {
                             if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
+                                collegeCurriculumCore.setScholarships("0-100");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
+                                collegeCurriculumCore.setScholarships("0");
                                 collegeCurriculumCore.setCredit(0);
                             }
                         }
@@ -134,13 +166,28 @@ public class CollegeCurriculumCoreService {
                     for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
                         if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("core");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumCore.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumCore.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumCore.setScholarships("0-100");
+                            }
                         } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
                             collegeCurriculumCore.setStatus("待完成");
+                            collegeCurriculumCore.setScholarships("0-100");
                         } else {
                             if (collegeCurriculumCore.getC_step() >= LMP - DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
+                                collegeCurriculumCore.setScholarships("0-100");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
+                                collegeCurriculumCore.setScholarships("0");
                                 collegeCurriculumCore.setCredit(0);
                             }
                         }
@@ -169,13 +216,27 @@ public class CollegeCurriculumCoreService {
             if (returnUserLearningCoreDetail.getStatus() != null && returnUserLearningCoreDetail.getStatus() == 9) {
                 list.put("collegeStatus", "完成度100%");
                 list.put("collegeFinish", "已完成");
+                CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                collegeScholarshipsDetailQuery.setOpenid(collegeCurriculumQuery.getOpenid());
+                collegeScholarshipsDetailQuery.setEvent_code(1);
+                collegeScholarshipsDetailQuery.setType("learning");
+                collegeScholarshipsDetailQuery.setCollege_type("core");
+                collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumQuery.getId());
+                CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                if(collegeScholarshipsDetail != null) {
+                    list.put("collegeScholarships", String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                } else {
+                    list.put("collegeScholarships", "0-100");
+                }
             } else if (returnUserLearningCoreDetail.getStatus() != null && returnUserLearningCoreDetail.getStatus() == 2) {
                 if (returnUserLearningCoreDetail.getRate().equals("100%")) {
                     list.put("collegeStatus", "完成度100%");
                     list.put("collegeFinish", "已完成");
+                    list.put("collegeScholarships", "0-100");
                 } else {
                     list.put("collegeStatus", "完成度" + returnUserLearningCoreDetail.getRate());
                     list.put("collegeFinish", "未完成");
+                    list.put("collegeScholarships", "0-100");
                 }
             } else {
                 //判断是否已过期
@@ -188,19 +249,23 @@ public class CollegeCurriculumCoreService {
                         if (returnUserLearningCoreDetail.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                             list.put("collegeStatus", "完成度0%");
                             list.put("collegeFinish", "未完成");
+                            list.put("collegeScholarships", "0-100");
                         } else {
                             list.put("collegeStatus", "完成度0%");
                             list.put("collegeFinish", "未完成");
                             returnUserLearningCoreDetail.setCredit(0);
+                            list.put("collegeScholarships", "0");
                         }
                     } else if (wxUser.getXu_content_type().equals("P01")) {
                         if (returnUserLearningCoreDetail.getC_step() >= LMP - DateUtil.getWeekDiff(dateNow, getDate)) {
                             list.put("collegeStatus", "完成度0%");
                             list.put("collegeFinish", "未完成");
+                            list.put("collegeScholarships", "0-100");
                         } else {
                             list.put("collegeStatus", "完成度0%");
                             list.put("collegeFinish", "未完成");
                             returnUserLearningCoreDetail.setCredit(0);
+                            list.put("collegeScholarships", "0");
                         }
                     } else {
                         return null;
@@ -291,7 +356,7 @@ public class CollegeCurriculumCoreService {
             }
             return 1;
         } else {
-            return 0;
+            return 8;
         }
     }
 

+ 32 - 6
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumExperienceService.java

@@ -2,10 +2,7 @@ package com.ygj.yuemum.service.college;
 
 import com.ygj.yuemum.component.Constant;
 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.college.*;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import com.ygj.yuemum.utils.DateUtil;
@@ -28,6 +25,8 @@ public class CollegeCurriculumExperienceService {
     private CollegeCurriculumExperienceDao collegeCurriculumExperienceDao;
     @Autowired
     private WXUserService wxUserService;
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
 
     public List<CollegeCurriculumExperience> getCollegeCurriculumExperiences() {
         List<CollegeCurriculumExperience> collegeCurriculumExperiences = collegeCurriculumExperienceDao.getAll();
@@ -56,18 +55,31 @@ public class CollegeCurriculumExperienceService {
     }
 
 
-    public CollegeCurriculumExperience queryExperienceDetail(CollegeQuery collegeQuery) throws ParseException {
+    public CollegeCurriculumExperience queryExperienceDetail(CollegeQuery collegeQuery) {
         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("已完成");
+            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+            collegeScholarshipsDetailQuery.setOpenid(collegeQuery.getOpenid());
+            collegeScholarshipsDetailQuery.setEvent_code(1);
+            collegeScholarshipsDetailQuery.setType("learning");
+            collegeScholarshipsDetailQuery.setCollege_type("core");
+            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumExperience.getId());
+            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+            if(collegeScholarshipsDetail != null) {
+                collegeCurriculumExperience.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+            } else {
+                collegeCurriculumExperience.setScholarships("0-100");
+            }
         } else if(collegeCurriculumExperience.getLearningStatus() != null && collegeCurriculumExperience.getLearningStatus().equals("1")){
             collegeCurriculumExperience.setLearningStatus("待完成");
             collegeCurriculumExperience.setStatus("查看预约");
+            collegeCurriculumExperience.setScholarships("0-100");
         } else {
             collegeCurriculumExperience.setLearningStatus("待完成");
             collegeCurriculumExperience.setStatus("立即预约");
+            collegeCurriculumExperience.setScholarships("0-100");
         }
         return collegeCurriculumExperience;
     }
@@ -114,12 +126,26 @@ public class CollegeCurriculumExperienceService {
                     if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                         collegeCurriculumExperience.setStatus("已完成");
                         collegeCurriculumExperience.setLearningStatus("已完成");
+                        CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                        collegeScholarshipsDetailQuery.setOpenid(openid);
+                        collegeScholarshipsDetailQuery.setEvent_code(1);
+                        collegeScholarshipsDetailQuery.setType("learning");
+                        collegeScholarshipsDetailQuery.setCollege_type("experience");
+                        collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumExperience.getId());
+                        CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                        if(collegeScholarshipsDetail != null) {
+                            collegeCurriculumExperience.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                        } else {
+                            collegeCurriculumExperience.setScholarships("0-100");
+                        }
                     } else if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("1")) {
                         collegeCurriculumExperience.setStatus("已预约");
                         collegeCurriculumExperience.setLearningStatus("查看预约");
+                        collegeCurriculumExperience.setScholarships("0-100");
                     } else {
                         collegeCurriculumExperience.setStatus("未完成");
                         collegeCurriculumExperience.setLearningStatus("立即预约");
+                        collegeCurriculumExperience.setScholarships("0-100");
                     }
                 }
                 tableData.put("collegeCurriculumExperiences", collegeCurriculumExperiences);

+ 38 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumPracticeService.java

@@ -25,6 +25,8 @@ public class CollegeCurriculumPracticeService {
     private CollegeCurriculumPracticeDao collegeCurriculumPracticeDao;
     @Autowired
     private WXUserService wxUserService;
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
 
 
     public List<CollegeCurriculumPractice> getCollegeCurriculumPractices() {
@@ -43,24 +45,44 @@ public class CollegeCurriculumPracticeService {
         SimpleDateFormat sd = new SimpleDateFormat("MM-dd HH:mm");
         long beginMillisecond = new Date().getTime();
         long endMillisecond = sdf.parse(collegeCurriculumPractice.getDeadline()).getTime();
+        CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+        collegeScholarshipsDetailQuery.setOpenid(collegeQuery.getOpenid());
+        collegeScholarshipsDetailQuery.setEvent_code(1);
+        collegeScholarshipsDetailQuery.setType("learning");
+        collegeScholarshipsDetailQuery.setCollege_type("practice");
+        collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumPractice.getId());
+        CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
         if(beginMillisecond > endMillisecond) {
             if(collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("9")) {
                 collegeCurriculumPractice.setLearningStatus("已完成");
                 collegeCurriculumPractice.setStatus("已完成");
+                if(collegeScholarshipsDetail != null) {
+                    collegeCurriculumPractice.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                } else {
+                    collegeCurriculumPractice.setScholarships("0-100");
+                }
             } else {
                 collegeCurriculumPractice.setLearningStatus("已过期");
                 collegeCurriculumPractice.setStatus("已过期");
+                collegeCurriculumPractice.setScholarships("0");
             }
         } else {
             if(collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("9")) {
                 collegeCurriculumPractice.setLearningStatus("已完成");
                 collegeCurriculumPractice.setStatus("已完成");
+                if(collegeScholarshipsDetail != null) {
+                    collegeCurriculumPractice.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                } else {
+                    collegeCurriculumPractice.setScholarships("0-100");
+                }
             } else if (collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("1")) {
                 collegeCurriculumPractice.setLearningStatus("已报名");
                 collegeCurriculumPractice.setStatus("查看报名");
+                collegeCurriculumPractice.setScholarships("0-100");
             } else {
                 collegeCurriculumPractice.setLearningStatus("待完成");
                 collegeCurriculumPractice.setStatus("立即报名");
+                collegeCurriculumPractice.setScholarships("0-100");
             }
         }
         collegeCurriculumPractice.setStartdate(sd.format(sdf.parse(collegeCurriculumPractice.getStartdate())));
@@ -128,21 +150,37 @@ public class CollegeCurriculumPracticeService {
                     if (collegeCurriculumPractice.getStatus() != null && collegeCurriculumPractice.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                         collegeCurriculumPractice.setLearningStatus("已完成");
                         collegeCurriculumPractice.setStatus("已完成");
+                        CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                        collegeScholarshipsDetailQuery.setOpenid(openid);
+                        collegeScholarshipsDetailQuery.setEvent_code(1);
+                        collegeScholarshipsDetailQuery.setType("learning");
+                        collegeScholarshipsDetailQuery.setCollege_type("practice");
+                        collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumPractice.getId());
+                        CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                        if(collegeScholarshipsDetail != null) {
+                            collegeCurriculumPractice.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                        } else {
+                            collegeCurriculumPractice.setScholarships("0-100");
+                        }
                     } else if (collegeCurriculumPractice.getStatus() != null && collegeCurriculumPractice.getStatus().equals("1")) {
                         if(dateNow.getTime() > endMillisecond) {
                             collegeCurriculumPractice.setLearningStatus("已过期");
                             collegeCurriculumPractice.setStatus("已过期");
+                            collegeCurriculumPractice.setScholarships("0");
                         } else {
                             collegeCurriculumPractice.setLearningStatus("查看报名");
                             collegeCurriculumPractice.setStatus("已报名");
+                            collegeCurriculumPractice.setScholarships("0-100");
                         }
                     } else {
                         if(dateNow.getTime() > endMillisecond) {
                             collegeCurriculumPractice.setLearningStatus("已过期");
                             collegeCurriculumPractice.setStatus("已过期");
+                            collegeCurriculumPractice.setScholarships("0");
                         } else {
                             collegeCurriculumPractice.setLearningStatus("立即报名");
                             collegeCurriculumPractice.setStatus("待完成");
+                            collegeCurriculumPractice.setScholarships("0-100");
                         }
                     }
                 }

+ 42 - 0
src/main/java/com/ygj/yuemum/service/college/CollegePresentCreditService.java

@@ -0,0 +1,42 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegePresentCreditDao;
+import com.ygj.yuemum.domain.college.CollegePresentCredit;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CollegePresentCreditService {
+
+    @Autowired
+    private CollegePresentCreditDao collegePresentCreditDao;
+
+    public List<CollegePresentCredit> getCollegePresentCredits() {
+        List<CollegePresentCredit> collegePresentCredits = collegePresentCreditDao.getAll();
+        return collegePresentCredits;
+    }
+
+    public CollegePresentCredit getCollegePresentCredit(Integer id) {
+        CollegePresentCredit collegePresentCredit = collegePresentCreditDao.selectByPrimaryKey(id);
+        return collegePresentCredit;
+    }
+
+    public int addCollegePresentCredit(CollegePresentCredit collegeUserPoints) {
+        return collegePresentCreditDao.insertSelective(collegeUserPoints);
+    }
+
+    public int deleteCollegePresentCredit(Integer id) {
+        return collegePresentCreditDao.deleteByPrimaryKey(id);
+    }
+
+    public int updateCollegePresentCredit(CollegePresentCredit collegeUserPoints) {
+        return collegePresentCreditDao.updateByPrimaryKeySelective(collegeUserPoints);
+    }
+
+    public List<CollegePresentCredit> queryUserReceived(String openid) {
+        return collegePresentCreditDao.queryUserReceived(openid);
+    }
+
+}

+ 0 - 42
src/main/java/com/ygj/yuemum/service/college/CollegePresentRuleService.java

@@ -1,42 +0,0 @@
-package com.ygj.yuemum.service.college;
-
-import com.ygj.yuemum.dao.college.CollegePresentRuleDao;
-import com.ygj.yuemum.domain.college.CollegePresentRule;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class CollegePresentRuleService {
-
-    @Autowired
-    private CollegePresentRuleDao collegePresentRuleDao;
-
-    public List<CollegePresentRule> getCollegePresentRules() {
-        List<CollegePresentRule> collegePresentRules = collegePresentRuleDao.getAll();
-        return collegePresentRules;
-    }
-
-    public CollegePresentRule getCollegePresentRule(Integer id) {
-        CollegePresentRule collegePresentRule = collegePresentRuleDao.selectByPrimaryKey(id);
-        return collegePresentRule;
-    }
-
-    public int addCollegePresentRule(CollegePresentRule collegeUserPoints) {
-        return collegePresentRuleDao.insertSelective(collegeUserPoints);
-    }
-
-    public int deleteCollegePresentRule(Integer id) {
-        return collegePresentRuleDao.deleteByPrimaryKey(id);
-    }
-
-    public int updateCollegePresentRule(CollegePresentRule collegeUserPoints) {
-        return collegePresentRuleDao.updateByPrimaryKeySelective(collegeUserPoints);
-    }
-
-    public List<CollegePresentRule> queryUserReceived(String openid) {
-        return collegePresentRuleDao.queryUserReceived(openid);
-    }
-
-}

+ 39 - 0
src/main/java/com/ygj/yuemum/service/college/CollegePresentScholarshipsLogsService.java

@@ -0,0 +1,39 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegePresentScholarshipsDao;
+import com.ygj.yuemum.dao.college.CollegePresentScholarshipsLogsDao;
+import com.ygj.yuemum.domain.college.CollegePresentScholarships;
+import com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CollegePresentScholarshipsLogsService {
+
+    @Autowired
+    private CollegePresentScholarshipsLogsDao collegePresentScholarshipsLogsDao;
+
+    public List<CollegePresentScholarshipsLogs> getCollegePresentScholarshipsLogs() {
+        List<CollegePresentScholarshipsLogs> collegePresentScholarshipsLogs = collegePresentScholarshipsLogsDao.getAll();
+        return collegePresentScholarshipsLogs;
+    }
+
+    public CollegePresentScholarshipsLogs getCollegePresentScholarshipsLog(Integer id) {
+        CollegePresentScholarshipsLogs collegePresentScholarshipsLogs = collegePresentScholarshipsLogsDao.selectByPrimaryKey(id);
+        return collegePresentScholarshipsLogs;
+    }
+
+    public int addCollegePresentScholarshipsLogs(CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) {
+        return collegePresentScholarshipsLogsDao.insertSelective(collegePresentScholarshipsLogs);
+    }
+
+    public int deleteCollegePresentScholarshipsLogs(Integer id) {
+        return collegePresentScholarshipsLogsDao.deleteByPrimaryKey(id);
+    }
+
+    public int updateCollegePresentScholarshipsLogs(CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) {
+        return collegePresentScholarshipsLogsDao.updateByPrimaryKeySelective(collegePresentScholarshipsLogs);
+    }
+}

+ 40 - 0
src/main/java/com/ygj/yuemum/service/college/CollegePresentScholarshipsService.java

@@ -0,0 +1,40 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegePresentScholarshipsDao;
+import com.ygj.yuemum.domain.college.CollegePresentScholarships;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CollegePresentScholarshipsService {
+
+    @Autowired
+    private CollegePresentScholarshipsDao collegePresentScholarshipsDao;
+
+    public List<CollegePresentScholarships> getCollegePresentScholarships() {
+        List<CollegePresentScholarships> collegePresentScholarships = collegePresentScholarshipsDao.getAll();
+        return collegePresentScholarships;
+    }
+
+    public CollegePresentScholarships getCollegePresentScholarship(Integer id) {
+        CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsDao.selectByPrimaryKey(id);
+        return collegePresentScholarships;
+    }
+
+    public int addCollegePresentScholarship(CollegePresentScholarships collegeUserPoints) {
+        return collegePresentScholarshipsDao.insertSelective(collegeUserPoints);
+    }
+
+    public int deleteCollegePresentScholarship(Integer id) {
+        return collegePresentScholarshipsDao.deleteByPrimaryKey(id);
+    }
+
+    public int updateCollegePresentScholarship(CollegePresentScholarships collegeUserPoints) {
+        return collegePresentScholarshipsDao.updateByPrimaryKeySelective(collegeUserPoints);
+    }
+    public int addCollegePresentScholarshipCount(Integer id){
+        return collegePresentScholarshipsDao.addCollegePresentScholarshipCount(id);
+    }
+}

+ 233 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeScholarshipsDetailService.java

@@ -0,0 +1,233 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.component.Constant;
+import com.ygj.yuemum.dao.college.CollegeScholarshipsDetailDao;
+import com.ygj.yuemum.domain.college.*;
+import com.ygj.yuemum.service.coupon.CouponCreateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+@Service
+public class CollegeScholarshipsDetailService {
+    public Integer MAXSCHOLARSHIPS = Constant.MAXSCHOLARSHIPS;
+
+    @Autowired
+    private CollegeScholarshipsDetailDao collegeScholarshipsDetailDao;
+    @Autowired
+    private CollegeScholarshipsRuleService collegeScholarshipsRuleService;
+    @Autowired
+    private CollegeUserPointsService collegeUserPointsService;
+    @Autowired
+    private CollegePresentScholarshipsService collegePresentScholarshipsService;
+    @Autowired
+    private CollegePresentScholarshipsLogsService collegePresentScholarshipsLogsService;
+    @Autowired
+    private CouponCreateService couponCreateService;
+
+    public List<CollegeScholarshipsDetail> getAll() {
+        return collegeScholarshipsDetailDao.getAll();
+    }
+
+    public CollegeScholarshipsDetail selectByPrimaryKey(Integer id) {
+        return collegeScholarshipsDetailDao.selectByPrimaryKey(id);
+    }
+
+    public int deleteByPrimaryKey(Integer id) {
+        return collegeScholarshipsDetailDao.deleteByPrimaryKey(id);
+    }
+
+    public int insertSelective(CollegeScholarshipsDetail record) {
+        return collegeScholarshipsDetailDao.insertSelective(record);
+    }
+
+    public int updateByPrimaryKeySelective(CollegeScholarshipsDetail record) {
+        return collegeScholarshipsDetailDao.updateByPrimaryKeySelective(record);
+    }
+    public  CollegeScholarshipsDetail  queryCollegeScholarships(CollegeScholarshipsDetail collegeScholarshipsDetail) {
+        return collegeScholarshipsDetailDao.queryCollegeScholarships(collegeScholarshipsDetail);
+    }
+
+    public List<Object> queryUserScholarshipsLog(String openid) {
+        List<CollegeScholarshipsDetail> collegeScholarshipsDetails = collegeScholarshipsDetailDao.queryUserScholarshipsLog(openid);
+        List<Object> presentInfoTemp = new LinkedList<>();
+        for (CollegeScholarshipsDetail collegeScholarshipsDetail : collegeScholarshipsDetails) {
+            LinkedHashMap<String, Object> presents = new LinkedHashMap<>();
+            presents.put("scholarships", collegeScholarshipsDetail.getScholarships());
+            presents.put("create_at", collegeScholarshipsDetail.getCreate_at());
+            presents.put("account", collegeScholarshipsDetail.getAccount());
+            if (collegeScholarshipsDetail.getType().equals("learning")) {
+                if (collegeScholarshipsDetail.getCollege_type().equals("core")) {
+                    presents.put("logContent", "课程学习[常规课]");
+                } else if (collegeScholarshipsDetail.getCollege_type().equals("practice")) {
+                    presents.put("logContent", "课程学习[活动课]");
+                } else if (collegeScholarshipsDetail.getCollege_type().equals("experience")) {
+                    presents.put("logContent", "课程学习[体验课]");
+                } else {
+                    presents.put("error", "没有找到学院对应课程类型");
+                }
+            } else if (collegeScholarshipsDetail.getType().equals("consume")) {
+                //查找兑换类型
+                CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(collegeScholarshipsDetail.getCollege_id());
+                presents.put("logContent", "礼品兑换["+collegePresentScholarships.getName()+"]");
+            } else if (collegeScholarshipsDetail.getType().equals("first")) {
+                if (collegeScholarshipsDetail.getCollege_type().equals("core")) {
+                    presents.put("logContent", "首次额奖励[常规课]");
+                } else if (collegeScholarshipsDetail.getCollege_type().equals("practice")) {
+                    presents.put("logContent", "首次额奖励[活动课]");
+                } else if (collegeScholarshipsDetail.getCollege_type().equals("experience")) {
+                    presents.put("logContent", "首次额奖励[体验课]");
+                } else {
+                    presents.put("error", "没有找到学院对应课程类型");
+                }
+            } else {
+                presents.put("error", "消费类型");
+            }
+            presentInfoTemp.add(presents);
+        }
+        return presentInfoTemp;
+    }
+
+
+    //增加奖学金
+    public int addScholarships(String openid, String type, String college_type, Integer college_id, Integer credit, Integer testResult) {
+        CollegeUserPoints collegeUserPoints = collegeUserPointsService.queryOneUserPoints(openid);
+        CollegeScholarshipsRule collegeScholarshipsRule = collegeScholarshipsRuleService.getScholarshipsRule(college_type);
+        CollegeScholarshipsDetail collegeScholarshipsDetail = new CollegeScholarshipsDetail();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        boolean first = false;
+        int scholarships = 0;
+        int scholarships_log = 0;
+        int account = 0;
+        if (college_type.equals("core")) {
+            scholarships = credit * testResult; //先写死 学分 * 测试成绩
+        } else if (college_type.equals("experience")) {
+            scholarships = collegeScholarshipsRule.getScholarships();
+        } else if (college_type.equals("practice")) {
+            scholarships = collegeScholarshipsRule.getScholarships();
+        } else {
+            return 0;
+        }
+        scholarships_log = scholarships;
+        if (collegeUserPoints != null) {
+            if (collegeUserPoints.getScholarships_total() >= MAXSCHOLARSHIPS) {
+                return 9;//奖学金达到上限
+            } else {
+                //查看first
+                CollegeScholarshipsDetail firstQuery = new CollegeScholarshipsDetail();
+                firstQuery.setOpenid(openid);
+                firstQuery.setType("first");
+                firstQuery.setEvent_code(1);
+                firstQuery.setCollege_type(college_type);
+                if (collegeScholarshipsDetailDao.checkFirst(firstQuery) == 0) {
+                    first = true;
+                }
+                CollegeScholarshipsDetail checkQuery = new CollegeScholarshipsDetail();
+                checkQuery.setOpenid(openid);
+                checkQuery.setType(type);
+                checkQuery.setCollege_type(college_type);
+                checkQuery.setEvent_code(1);
+                checkQuery.setCollege_id(college_id);
+                if (collegeScholarshipsDetailDao.checkFirst(checkQuery) != 0) {
+                    return 8;
+                }
+                if (scholarships + collegeUserPoints.getScholarships_total() > MAXSCHOLARSHIPS) {
+                    account = MAXSCHOLARSHIPS;
+                    scholarships_log = MAXSCHOLARSHIPS - collegeUserPoints.getScholarships_total();
+                    collegeUserPoints.setScholarships_total(MAXSCHOLARSHIPS);
+                    collegeUserPoints.setScholarships_available(MAXSCHOLARSHIPS);
+                } else {
+                    account = collegeUserPoints.getScholarships_available() + scholarships;
+                    collegeUserPoints.setScholarships_total(collegeUserPoints.getScholarships_total() + scholarships);
+                    collegeUserPoints.setScholarships_available(collegeUserPoints.getScholarships_available() + scholarships);
+                }
+                collegeUserPointsService.updateScholarships(collegeUserPoints);
+            }
+        } else {
+            CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints();
+            collegeUserPointsNew.setOpenid(openid);
+            collegeUserPointsNew.setCredit_total(0);
+            collegeUserPointsNew.setCredit_available(0);
+            collegeUserPointsNew.setScholarships_available(scholarships);
+            collegeUserPointsNew.setScholarships_total(scholarships);
+            first = true;
+            collegeUserPointsService.addCollegeUserPoints(collegeUserPointsNew);
+        }
+
+        collegeScholarshipsDetail.setOpenid(openid);
+        collegeScholarshipsDetail.setType(type);
+        collegeScholarshipsDetail.setCollege_type(college_type);
+        collegeScholarshipsDetail.setEvent_code(1);
+        collegeScholarshipsDetail.setCollege_id(college_id);
+        collegeScholarshipsDetail.setScholarships(scholarships_log);
+        collegeScholarshipsDetail.setAccount(account);
+        collegeScholarshipsDetail.setCreate_at(sdf.format(new Date()));
+        collegeScholarshipsDetailDao.insertSelective(collegeScholarshipsDetail);
+        if (first) {
+            CollegeUserPoints collegeUserPointsFirst = collegeUserPointsService.queryOneUserPoints(openid);
+            CollegeScholarshipsDetail collegeScholarshipsDetailFirst = new CollegeScholarshipsDetail();
+            collegeScholarshipsDetailFirst.setOpenid(openid);
+            collegeScholarshipsDetailFirst.setType("first");
+            collegeScholarshipsDetailFirst.setCollege_type(college_type);
+            collegeScholarshipsDetailFirst.setAccount(collegeScholarshipsRule.getFirst() + collegeUserPointsFirst.getScholarships_available());
+            collegeScholarshipsDetailFirst.setEvent_code(1);
+            collegeScholarshipsDetailFirst.setScholarships(collegeScholarshipsRule.getFirst());
+            collegeScholarshipsDetailFirst.setCreate_at(sdf.format(new Date()));
+            collegeScholarshipsDetailDao.insertSelective(collegeScholarshipsDetailFirst);
+            collegeUserPointsFirst.setScholarships_available(collegeUserPointsFirst.getScholarships_available() + collegeScholarshipsRule.getFirst());
+            collegeUserPointsFirst.setScholarships_total(collegeUserPointsFirst.getScholarships_total() + collegeScholarshipsRule.getFirst());
+            collegeUserPointsService.updateScholarships(collegeUserPointsFirst);
+        }
+        return 1;
+    }
+
+    //减少奖学金
+    public int subtractScholarships(CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) {
+        CollegeScholarshipsDetail collegeScholarshipsDetail = new CollegeScholarshipsDetail();
+        CollegeUserPoints collegeUserPoints = collegeUserPointsService.queryOneUserPoints(collegePresentScholarshipsLogs.getOpenid());
+        CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(collegePresentScholarshipsLogs.getPresent_id());
+        CollegePresentScholarshipsLogs collegePresentScholarshipsLogsNew = new CollegePresentScholarshipsLogs();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        int scholarships = collegeUserPoints.getScholarships_available() - collegePresentScholarships.getScholarships();
+        int scholarships_log = -collegePresentScholarships.getScholarships();
+        //兑换日志
+        collegeScholarshipsDetail.setOpenid(collegePresentScholarshipsLogs.getOpenid());
+        collegeScholarshipsDetail.setEvent_code(2);
+        collegeScholarshipsDetail.setType("consume");
+        collegeScholarshipsDetail.setCollege_id(collegePresentScholarshipsLogs.getPresent_id()); //礼品id
+        collegeScholarshipsDetail.setScholarships(scholarships_log);
+        collegeScholarshipsDetail.setAccount(scholarships);
+        collegeScholarshipsDetail.setCreate_at(sdf.format(new Date()));
+        collegeScholarshipsDetailDao.insertSelective(collegeScholarshipsDetail);
+        //奖学金减少
+        collegeUserPoints.setScholarships_available(collegeUserPoints.getScholarships_available() - collegePresentScholarships.getScholarships());
+        collegeUserPointsService.updateScholarships(collegeUserPoints);
+        //log增加
+        collegePresentScholarshipsLogsNew.setOpenid(collegePresentScholarshipsLogs.getOpenid());
+        collegePresentScholarshipsLogsNew.setPresent_id(collegePresentScholarshipsLogs.getPresent_id());
+        collegePresentScholarshipsLogsNew.setType(collegePresentScholarships.getType());
+        collegePresentScholarshipsLogsNew.setCreate_at(sdf.format(new Date()));
+        if(collegePresentScholarships.getType() == 1) {
+            //优惠券发放 testtttttt
+            String cb_code = couponCreateService.couponIssue(collegePresentScholarships.getCoupon_id(), collegePresentScholarshipsLogs.getOpenid(),"College");
+            collegePresentScholarshipsLogsNew.setCoupon_number(cb_code);
+        } else if (collegePresentScholarships.getType() == 2) {
+            //到店领取
+            collegePresentScholarshipsLogsNew.setCollection_date(collegePresentScholarshipsLogs.getCollection_date());
+            collegePresentScholarshipsLogsNew.setMkt_id(collegePresentScholarshipsLogs.getMkt_id());
+        } else if (collegePresentScholarships.getType() == 3) {
+            //邮寄
+            collegePresentScholarshipsLogsNew.setAddress(collegePresentScholarshipsLogs.getAddress());
+        }
+        collegePresentScholarshipsLogsService.addCollegePresentScholarshipsLogs(collegePresentScholarshipsLogsNew);
+        //礼品兑换统计+1
+        collegePresentScholarshipsService.addCollegePresentScholarshipCount(collegePresentScholarshipsLogs.getPresent_id());
+        return 1;
+    }
+
+}

+ 18 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeScholarshipsRuleService.java

@@ -0,0 +1,18 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegeScholarshipsRuleDao;
+import com.ygj.yuemum.domain.college.CollegeScholarshipsRule;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CollegeScholarshipsRuleService {
+
+    @Autowired
+    private CollegeScholarshipsRuleDao collegeScholarshipsRuleDao;
+
+    public CollegeScholarshipsRule getScholarshipsRule(String type) {
+        CollegeScholarshipsRule collegePresentRules = collegeScholarshipsRuleDao.getScholarshipsRule(type);
+        return collegePresentRules;
+    }
+}

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

@@ -26,6 +26,8 @@ public class CollegeTestDetailService {
     private CollegeLearningDetailService collegeLearningDetailService;
     @Autowired
     private CollegeCurriculumCoreService collegeCurriculumCoreService;
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
 
     public List<CollegeTestDetail> getCollegeTestDetails() {
         List<CollegeTestDetail> collegeTestDetails = collegeTestDetailDao.getAll();
@@ -123,6 +125,9 @@ public class CollegeTestDetailService {
                 collegeUserPoints.setCredit_total(collegeCurriculumCore.getCredit());
                 collegeUserPointsService.addCollegeUserPoints(collegeUserPoints);
             }
+            //增加奖学金
+            CollegeCurriculumCore collegeCurriculumCoreTemp = collegeCurriculumCoreService.getCollegeCurriculumCore(core_id);
+            collegeScholarshipsDetailService.addScholarships(openid,"learning","core",core_id,collegeCurriculumCoreTemp.getCredit(),score);
             return tableData;
         } else {
             tableData.put("score","已做过测试");

+ 21 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeUserLevelService.java

@@ -0,0 +1,21 @@
+package com.ygj.yuemum.service.college;
+
+import com.ygj.yuemum.dao.college.CollegeUserLevelDao;
+import com.ygj.yuemum.domain.college.CollegeUserLevel;
+import org.omg.PortableInterceptor.INACTIVE;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CollegeUserLevelService {
+
+    @Autowired
+    private CollegeUserLevelDao collegeUserLevelDao;
+
+    public CollegeUserLevel getUserLevel(Integer credit) {
+        CollegeUserLevel collegeUserLevel = collegeUserLevelDao.getUserLevel(credit);
+        return collegeUserLevel;
+    }
+
+
+}

+ 187 - 16
src/main/java/com/ygj/yuemum/service/college/CollegeUserPointsService.java

@@ -5,9 +5,11 @@ import com.ygj.yuemum.controller.global.WeChatInfoController;
 import com.ygj.yuemum.dao.college.CollegeUserPointsDao;
 import com.ygj.yuemum.domain.college.*;
 import com.ygj.yuemum.domain.customer.CustomerBooking;
+import com.ygj.yuemum.domain.wxmini.WXMktInfo;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.coupon.CouponCreateService;
 import com.ygj.yuemum.service.customer.CustomerBookingService;
+import com.ygj.yuemum.service.wxmini.WXMktInfoService;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import com.ygj.yuemum.utils.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +19,7 @@ import com.ygj.yuemum.utils.DistanceUtil;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 
 @Service
@@ -27,7 +30,7 @@ public class CollegeUserPointsService {
     @Autowired
     private WXUserService wxUserService;
     @Autowired
-    private CollegePresentRuleService collegePresentRuleService;
+    private CollegePresentCreditService collegePresentCreditService;
     @Autowired
     private CollegeCurriculumCoreService collegeCurriculumCoreService;
     @Autowired
@@ -46,6 +49,16 @@ public class CollegeUserPointsService {
     private CollegeBookingService collegeBookingService;
     @Autowired
     private CollegeLearningDetailService collegeLearningDetailService;
+    @Autowired
+    private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
+    @Autowired
+    private CollegePresentScholarshipsService collegePresentScholarshipsService;
+    @Autowired
+    private CollegeUserLevelService collegeUserLevelService;
+    @Autowired
+    private WXMktInfoService wxMktInfoService;
+
+
 
 
     public Integer LMP = Constant.LMP;
@@ -77,11 +90,15 @@ public class CollegeUserPointsService {
         return collegeUserPointsDao.updatePointsByTest(collegePointsDetail);
     }
 
+    public int updateScholarships(CollegeUserPoints collegePointsDetail) {
+        return collegeUserPointsDao.updateScholarships(collegePointsDetail);
+    }
+
     public CollegeUserPoints queryOneUserPoints(String openid) {
         return collegeUserPointsDao.queryOneUserPoints(openid);
     }
 
-    public LinkedHashMap<String, Object> QueryUserPoints(String openid, String city) {
+    public LinkedHashMap<String, Object> queryUserPoints(String openid, String city) {
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
         WXUser wxUser = wxUserService.getWXUser(openid);
         tableData.put("stage", null);
@@ -154,36 +171,36 @@ public class CollegeUserPointsService {
                         point_available = collegeUserPoints.getCredit_total();
                     }
                     //礼品领取情况
-                    List<CollegePresentRule> collegePresentRules = collegePresentRuleService.queryUserReceived(openid);
-                    for (CollegePresentRule collegePresentRule : collegePresentRules) {
-                        if (collegePresentRule.getReceived() != 1 && point_available >= collegePresentRule.getValue()) {
+                    List<CollegePresentCredit> collegePresentCredits = collegePresentCreditService.queryUserReceived(openid);
+                    for (CollegePresentCredit collegePresentCredit : collegePresentCredits) {
+                        if (collegePresentCredit.getReceived() != 1 && point_available >= collegePresentCredit.getValue()) {
                             //返回礼品内容
                             tableData.put("surprise", "true");
-                            tableData.put("surprise_type", collegePresentRule.getType());
-                            tableData.put("surprise_name", collegePresentRule.getPresent_name());
+                            tableData.put("surprise_type", collegePresentCredit.getType());
+                            tableData.put("surprise_name", collegePresentCredit.getPresent_name());
                             //自动发放礼品
-                            if (collegePresentRule.getType() == 1) {
+                            if (collegePresentCredit.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());
+                                customerBooking.setBk_desc(collegePresentCredit.getPresent_name());
                                 customerBookingService.insertCustomerBooking(customerBooking);
                                 weChatInfoController.WXSendBookingMessage(customerBooking);
-                                collegePointsDetail.setContext(collegePresentRule.getPresent_name());
+                                collegePointsDetail.setContext(collegePresentCredit.getPresent_name());
                             } else {
                                 //优惠券领取接口
-                                String cb_code = couponCreateService.couponIssue(collegePresentRule.getCoupon_cid(), wxUser.getXu_phone());
-                                collegePointsDetail.setContext(collegePresentRule.getPresent_name() + ":" + cb_code);
+                                String cb_code = couponCreateService.couponIssue(collegePresentCredit.getCoupon_cid(), wxUser.getXu_phone(),"College");
+                                collegePointsDetail.setContext(collegePresentCredit.getPresent_name() + ":" + cb_code);
                             }
                             //保存领取日志
                             collegePointsDetail.setOpenid(openid);
                             collegePointsDetail.setDate(ldf.format(new Date()));
                             collegePointsDetail.setEvent_code(4);
-                            collegePointsDetail.setCredit(collegePresentRule.getValue() * -1);
-                            collegePointsDetail.setRule_id(collegePresentRule.getId());
+                            collegePointsDetail.setCredit(collegePresentCredit.getValue() * -1);
+                            collegePointsDetail.setRule_id(collegePresentCredit.getId());
                             collegePointsDetailService.addCollegePointsDetail(collegePointsDetail);
                             //更新学分  学分不减
 //                            collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue());
@@ -191,24 +208,40 @@ public class CollegeUserPointsService {
                             break;
                         }
                     }
-                    tableData.put("present_received", collegePresentRules);
+                    tableData.put("present_received", collegePresentCredits);
                     //常规课
                     List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreService.queryCoreByStep(collegeCurriculumCoreQuery);
                     for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
                         if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumCore.setStatus("已完成");
+                            //获取实际奖学金
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("core");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumCore.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumCore.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumCore.setScholarships("0-100");
+                            }
+
                         } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
                             collegeCurriculumCore.setStatus("待完成");
+                            collegeCurriculumCore.setScholarships("0-100");
                         } else {
                             if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
                                 collegeCurriculumCore.setStatus("待完成");
+                                collegeCurriculumCore.setScholarships("0-100");
                             } else {
                                 collegeCurriculumCore.setStatus("未完成");
+                                collegeCurriculumCore.setScholarships("0");
                             }
                         }
                     }
                     tableData.put("college_core", collegeCurriculumCores);
-
                     //实践课
                     collegeCurriculumPracticeQuery.setDeadline(sdf.format(new Date()));
                     collegeCurriculumPracticeQuery.setCity(city);
@@ -223,17 +256,32 @@ public class CollegeUserPointsService {
                             collegeCurriculumPractice.setStatus("已完成");
                             //已完成
                             collegeCurriculumPractice.setLearningStatus("已完成");
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("practice");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumPractice.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumPractice.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumPractice.setScholarships("0-100");
+                            }
+
                         } else if (collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("1")) {
                             if (now.getTime() > deadLine.getTime()) {
                                 //未完成
                                 collegeCurriculumPractice.setStatus("未完成");
                                 //已过期
                                 collegeCurriculumPractice.setLearningStatus("已过期");
+                                collegeCurriculumPractice.setScholarships("0");
                             } else {
                                 //待完成
                                 collegeCurriculumPractice.setStatus("已报名");
                                 //查看报名
                                 collegeCurriculumPractice.setLearningStatus("查看报名");
+                                collegeCurriculumPractice.setScholarships("0-100");
                             }
                         } else {
                             if (now.getTime() > deadLine.getTime()) {
@@ -241,16 +289,19 @@ public class CollegeUserPointsService {
                                 collegeCurriculumPractice.setStatus("未完成");
                                 //已过期
                                 collegeCurriculumPractice.setLearningStatus("已过期");
+                                collegeCurriculumPractice.setScholarships("0");
                             } else if (collegeCurriculumPractice.getPcount() >= 99) {
                                 //未完成
                                 collegeCurriculumPractice.setStatus("未完成");
                                 //已约满
                                 collegeCurriculumPractice.setLearningStatus("已约满");
+                                collegeCurriculumPractice.setScholarships("0-100");
                             } else {
                                 //待完成
                                 collegeCurriculumPractice.setStatus("待完成");
                                 //立即报名
                                 collegeCurriculumPractice.setLearningStatus("立即报名");
+                                collegeCurriculumPractice.setScholarships("0-100");
                             }
                         }
                     }
@@ -262,12 +313,27 @@ public class CollegeUserPointsService {
                         if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                             collegeCurriculumExperience.setStatus("已完成");
                             collegeCurriculumExperience.setLearningStatus("已完成");
+                            CollegeScholarshipsDetail collegeScholarshipsDetailQuery = new CollegeScholarshipsDetail();
+                            collegeScholarshipsDetailQuery.setOpenid(openid);
+                            collegeScholarshipsDetailQuery.setEvent_code(1);
+                            collegeScholarshipsDetailQuery.setType("learning");
+                            collegeScholarshipsDetailQuery.setCollege_type("experience");
+                            collegeScholarshipsDetailQuery.setCollege_id(collegeCurriculumExperience.getId());
+                            CollegeScholarshipsDetail collegeScholarshipsDetail = collegeScholarshipsDetailService.queryCollegeScholarships(collegeScholarshipsDetailQuery);
+                            if(collegeScholarshipsDetail != null) {
+                                collegeCurriculumExperience.setScholarships(String.valueOf(collegeScholarshipsDetail.getScholarships()));
+                            } else {
+                                collegeCurriculumExperience.setScholarships("0-100");
+                            }
+
                         } else if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("1")) {
                             collegeCurriculumExperience.setStatus("已预约");
                             collegeCurriculumExperience.setLearningStatus("查看预约");
+                            collegeCurriculumExperience.setScholarships("0-100");
                         } else {
                             collegeCurriculumExperience.setStatus("未完成");
                             collegeCurriculumExperience.setLearningStatus("立即预约");
+                            collegeCurriculumExperience.setScholarships("0-100");
                         }
                     }
                     tableData.put("college_experience", collegeCurriculumExperiences);
@@ -289,6 +355,8 @@ public class CollegeUserPointsService {
     public int getPointsByOffline(String openid, String c_code, String lat, String lon) {
         //51-参数错误 52-没有预约 53-不在范围 54-已完成
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String college_type = "";
+        Integer id = null;
         if (c_code.indexOf("College") == -1) {
             return 51; //参数错误
         }
@@ -299,15 +367,19 @@ public class CollegeUserPointsService {
         int credit = 0;
         if (collegeBookingService.checkBooking(collegeBooking) != null) {
             if (c_code.substring(7, 1) == "P") {
+                college_type = "practice";
                 CollegeCurriculumPractice collegeCurriculumPractice = collegeCurriculumPracticeService.getPracticeByCode(c_code);
                 lat_l = collegeCurriculumPractice.getMi_latitude();
                 lon_l = collegeCurriculumPractice.getMi_longitude();
                 credit = collegeCurriculumPractice.getCredit();
+                id = collegeCurriculumPractice.getId();
             } else if (c_code.substring(7, 1) == "E") {
+                college_type = "experience";
                 CollegeCurriculumExperience collegeCurriculumExperience = collegeCurriculumExperienceService.getExperienceByCode(c_code.substring(8, c_code.length()));
                 lat_l = collegeCurriculumExperience.getLatitude();
                 lon_l = collegeCurriculumExperience.getLongitude();
                 credit = collegeCurriculumExperience.getCredit();
+                id = collegeCurriculumExperience.getId();
             } else {
                 return 51; //参数错误
             }
@@ -342,6 +414,8 @@ public class CollegeUserPointsService {
                     collegeUserPointsNew.setCredit_total(collegeUserPoints.getCredit_total() + credit);
                     collegeUserPointsNew.setCredit_available(collegeUserPoints.getCredit_available() + credit);
                 }
+                //增加奖学金
+                collegeScholarshipsDetailService.addScholarships(openid, "learning",college_type, id, null, null);
                 return 1;
             }
         } else {
@@ -349,4 +423,101 @@ public class CollegeUserPointsService {
         }
     }
 
+    public LinkedHashMap<String, Object> queryRedeemIndex(String openid) {
+        LinkedHashMap<String, Object> userInfo = new LinkedHashMap<>();
+        LinkedHashMap<String, Object> returnInfo = new LinkedHashMap<>();
+        List<Object> presentInfoTemp = new LinkedList<>();
+        WXUser wxUser = wxUserService.getWXUser(openid);
+        CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid);
+        CollegeUserLevel collegeUserLevel = collegeUserLevelService.getUserLevel(collegeUserPoints.getCredit_available());
+        int level = 0;
+        if (collegeUserLevel != null) {
+            level = collegeUserLevel.getLevel();
+        }
+        userInfo.put("name", wxUser.getXu_name());
+        userInfo.put("avatarUrl", wxUser.getXu_avatarUrl());
+        userInfo.put("Scholarships", collegeUserPoints.getScholarships_available());
+        userInfo.put("level", level);
+        List<CollegePresentScholarships> collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarships();
+        for (CollegePresentScholarships collegePresentScholarship : collegePresentScholarships) {
+            LinkedHashMap<String, Object> presents = new LinkedHashMap<>();
+            //通过等级判断是否适合商品
+            presents.put("name", collegePresentScholarship.getName());
+            presents.put("level", collegePresentScholarship.getLevel());
+            presents.put("scholarships", collegePresentScholarship.getScholarships());
+            presents.put("list_img_href", collegePresentScholarship.getList_img_href());
+            presents.put("count", collegePresentScholarship.getCount());
+            if (collegePresentScholarship.getLevel() > level) {
+                presents.put("redeem ", false);
+            } else {
+                presents.put("redeem ", true);
+            }
+            presentInfoTemp.add(presents);
+        }
+
+        returnInfo.put("userInfo", userInfo);
+        returnInfo.put("presentInfo", presentInfoTemp);
+        return returnInfo;
+    }
+
+    public LinkedHashMap<String, Object> queryRedeem(Integer presentId) {
+        LinkedHashMap<String, Object> returnInfo = new LinkedHashMap<>();
+        CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(presentId);
+        returnInfo.put("detail_img_href",collegePresentScholarships.getDetail_img_href());
+        return returnInfo;
+    }
+
+    public LinkedHashMap<String, Object> queryRedeemDetail(Integer presentId,String openid) {
+        LinkedHashMap<String, Object> returnInfo = new LinkedHashMap<>();
+        CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(presentId);
+        CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid);
+        if(collegeUserPoints == null || collegePresentScholarships == null) {
+            returnInfo.put("error", "未找到信息");
+        } else {
+            returnInfo.put("level",collegePresentScholarships.getLevel());
+            returnInfo.put("presentType",collegePresentScholarships.getType());
+            returnInfo.put("presentName",collegePresentScholarships.getName());
+            returnInfo.put("presentRedeemImg",collegePresentScholarships.getRedeem_img_href());
+            returnInfo.put("presentScholarships",collegePresentScholarships.getScholarships());
+            returnInfo.put("userScholarships",collegeUserPoints.getScholarships_available());
+            if(collegePresentScholarships.getType() == 2) {
+                List<WXMktInfo> wxMktInfo = wxMktInfoService.getMktInfos(null);
+                returnInfo.put("mktInfo",wxMktInfo);
+            }
+        }
+        return returnInfo;
+    }
+
+    public LinkedHashMap<String, Object> userRedeem(CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) {
+        LinkedHashMap<String, Object> returnInfo = new LinkedHashMap<>();
+        CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(collegePresentScholarshipsLogs.getPresent_id());
+        CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(collegePresentScholarshipsLogs.getOpenid());
+        CollegeUserLevel collegeUserLevel = collegeUserLevelService.getUserLevel(collegeUserPoints.getCredit_available());
+        int level = 0;
+        if (collegeUserLevel != null) {
+            level = collegeUserLevel.getLevel();
+        }
+        //判断等级
+        if(level < collegePresentScholarships.getLevel()) {
+            returnInfo.put("code","90");
+            returnInfo.put("msg","等级未达到");
+            return returnInfo;
+        }
+        //判断奖学金
+        if(collegeUserPoints.getScholarships_available() < collegePresentScholarships.getScholarships()) {
+            returnInfo.put("code","91");
+            returnInfo.put("msg","奖学金不足");
+            return returnInfo;
+        }
+        //subtractScholarships
+        if(collegeScholarshipsDetailService.subtractScholarships(collegePresentScholarshipsLogs) == 1){
+            returnInfo.put("code","1");
+            returnInfo.put("msg","兑换成功");
+            return returnInfo;
+        } else {
+            returnInfo.put("code","99");
+            returnInfo.put("msg","系统异常");
+            return returnInfo;
+        }
+    }
 }

+ 13 - 1
src/main/java/com/ygj/yuemum/service/coupon/CouponCreateService.java

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
 import com.ygj.yuemum.dao.coupon.CouponCreateDao;
 import com.ygj.yuemum.domain.coupon.Coupon;
 import com.ygj.yuemum.domain.coupon.CouponCreate;
+import com.ygj.yuemum.domain.coupon.CouponLog;
 import com.ygj.yuemum.domain.customer.CustomerCoupon;
 import com.ygj.yuemum.service.customer.CustomerCouponService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +23,8 @@ public class CouponCreateService {
     private CouponService couponService;
     @Autowired
     private CustomerCouponService customerCouponService;
+    @Autowired
+    private CouponLogService couponLogService;
 
     //分页
     public Map<String, Object> getCouponCreates(int page, int limit) {
@@ -70,7 +73,7 @@ public class CouponCreateService {
         return 1;
     }
 
-    public String couponIssue(int coupon_cid,String phone) {
+    public String couponIssue(int coupon_cid,String phone,String channel) {
         try {
             CouponCreate couponCreate = couponCreateDao.selectByPrimaryKey(coupon_cid);
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -93,6 +96,15 @@ public class CouponCreateService {
                 customerCoupon.setCc_getdate(sdf.format( new Date()));
                 customerCoupon.setCc_getchannel(2);
                 customerCouponService.addCustomerCoupon(customerCoupon);
+                CouponLog couponLog  = new CouponLog();
+                couponLog.setCb_code(couponCreate.getCb_code());
+                couponLog.setCp_code(cp_code);
+                couponLog.setCl_type(2);
+                couponLog.setCl_mp(phone);
+                couponLog.setCl_user(1);
+                couponLog.setCl_billno(channel);
+                couponLog.setCl_date(sdf.format( new Date()));
+                couponLogService.addCouponLog(couponLog);
                 return cp_code;
             }
         } catch (Exception ex) {

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

@@ -159,6 +159,15 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/eLearning/courseworkComplete", "anon");
         filterChainDefinitionMap.put("/eLearning/courseworkUpdate", "anon");
         filterChainDefinitionMap.put("/eLearning/courseworkBooking", "anon");
+        filterChainDefinitionMap.put("/college/addScholarships", "anon");
+
+
+        // ------------------------------------------------------------------
+        filterChainDefinitionMap.put("/college/queryRedeemIndex", "anon");
+        filterChainDefinitionMap.put("/college/queryRedeem", "anon");
+        filterChainDefinitionMap.put("/college/queryUserScholarshipsLog", "anon");
+        filterChainDefinitionMap.put("/college/queryRedeemDetail", "anon");
+        filterChainDefinitionMap.put("/college/userRedeem", "anon");
 //        //用户,需要角色权限 “user”
 //        filterChainDefinitionMap.put("/user/**", "roles[user]");
 //        //管理员,需要角色权限 “admin”

+ 1 - 0
src/main/resources/application.yml

@@ -153,6 +153,7 @@ api:
 college:
   LMP: 43
   AGE: 12
+  MAXSCHOLARSHIPS: 12000
 
 
 

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

@@ -39,7 +39,8 @@
     </select>
 
 
-    <select id="queryUserLearningCoreDetail" resultType="com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumQuery">
+    <select id="queryUserLearningCoreDetail" resultType="com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail"
+            parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumQuery">
         SELECT
             ccc.*,
             (select result from college_test_detail where coreid = ccc.id and sys_type = 'YueSuo' and  `status` != 8 and openid = #{openid,jdbcType=VARCHAR}) result,
@@ -54,7 +55,6 @@
     </select>
 
 
-
     <select id="queryCoreDetail" resultType="com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail"
             parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumQuery">
         SELECT
@@ -403,7 +403,6 @@
     </update>
 
 
-
     <select id="queryELearning_Index" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumCore"
             parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumCore">
         select
@@ -416,7 +415,8 @@
     </select>
 
 
-    <select id="queryCourseworkList" resultType="com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumQuery">
+    <select id="queryCourseworkList" resultType="com.ygj.yuemum.domain.college.ReturnUserLearningCoreDetail"
+            parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumQuery">
         SELECT
             ccc.*,
             (select result from college_test_detail where coreid = ccc.id and sys_type = 'YueLife' and  `status` != 8 and openid = #{openid,jdbcType=VARCHAR}) result,
@@ -459,5 +459,4 @@
     </select>
 
 
-
 </mapper>

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

@@ -1,8 +1,8 @@
 <?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.CollegePresentRuleDao">
+<mapper namespace="com.ygj.yuemum.dao.college.CollegePresentCreditDao">
 
-    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegePresentRule">
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegePresentCredit">
         <id column="id" property="id" jdbcType="INTEGER"/>
         <result column="seq" property="seq" jdbcType="INTEGER"/>
         <result column="value" property="value" jdbcType="INTEGER"/>
@@ -13,38 +13,38 @@
     </resultMap>
     <!--获取所有数据-->
 
-    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegePresentRule">
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegePresentCredit">
         select
         *
-        from college_present_rule
+        from college_present_credit
         order by id desc
     </select>
 
 
-    <select id="queryUserReceived" resultType="com.ygj.yuemum.domain.college.CollegePresentRule" parameterType="java.lang.String">
+    <select id="queryUserReceived" resultType="com.ygj.yuemum.domain.college.CollegePresentCredit" parameterType="java.lang.String">
 	SELECT
         cpr.*,
         if ((SELECT id FROM college_points_detail WHERE openid = #{openid,jdbcType=VARCHAR} and event_code = 4 and  rule_id = cpr.id) >= 1 ,1,0)  received
     FROM
-	    college_present_rule  as cpr
+	    college_present_credit  as cpr
 	order by seq asc
     </select>
 
-    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegePresentRule"
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegePresentCredit"
             parameterType="java.lang.Integer">
         select
         *
-        from college_present_rule
+        from college_present_credit
         where id = #{id,jdbcType=INTEGER}
     </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-        delete from college_present_rule
+        delete from college_present_credit
         where id = #{id,jdbcType=INTEGER}
     </delete>
 
-    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentRule">
-        insert into college_present_rule
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentCredit">
+        insert into college_present_credit
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="seq != null">
                 seq,
@@ -87,8 +87,8 @@
         </trim>
     </insert>
 
-    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentRule">
-        update college_present_rule
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentCredit">
+        update college_present_credit
         <set>
             <if test="seq != null">
                 seq = #{seq,jdbcType=INTEGER},

+ 125 - 0
src/main/resources/mybatis/mapper/college/CollegePresentScholarshipsLogsMapper.xml

@@ -0,0 +1,125 @@
+<?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.CollegePresentScholarshipsLogsDao">
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="openid" property="openid" jdbcType="VARCHAR"/>
+        <result column="present_id" property="present_id" jdbcType="INTEGER"/>
+        <result column="type" property="type" jdbcType="INTEGER"/>
+        <result column="create_at" property="create_at" jdbcType="VARCHAR"/>
+        <result column="collection_date" property="collection_date" jdbcType="VARCHAR"/>
+        <result column="mkt_id" property="mkt_id" jdbcType="INTEGER"/>
+        <result column="address" property="address" jdbcType="VARCHAR"/>
+        <result column="coupon_number" property="coupon_number" jdbcType="VARCHAR"/>
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs">
+        select
+        *
+        from college_present_scholarships_logs
+        order by id desc
+    </select>
+
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs"
+            parameterType="java.lang.Integer">
+        select
+        *
+        from college_present_scholarships_logs
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete from college_present_scholarships_logs
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs">
+        insert into college_present_scholarships_logs
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="openid != null">
+                openid ,
+            </if>
+            <if test="present_id != null">
+                present_id,
+            </if>
+            <if test="type != null">
+                `type`,
+            </if>
+            <if test="create_at != null">
+                create_at,
+            </if>
+            <if test="collection_date != null">
+                collection_date,
+            </if>
+            <if test="mkt_id != null">
+                mkt_id,
+            </if>
+            <if test="address != null">
+                address,
+            </if>
+            <if test="coupon_number != null">
+                coupon_number
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="openid != null">
+                #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="present_id != null">
+                #{present_id,jdbcType=INTEGER},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="create_at != null">
+                #{create_at,jdbcType=VARCHAR},
+            </if>
+            <if test="collection_date != null">
+                #{collection_date,jdbcType=VARCHAR},
+            </if>
+            <if test="mkt_id != null">
+                #{mkt_id,jdbcType=INTEGER},
+            </if>
+            <if test="address != null">
+                #{address,jdbcType=VARCHAR},
+            </if>
+            <if test="coupon_number != null">
+                #{coupon_number,jdbcType=VARCHAR}
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentScholarshipsLogs">
+        update college_present_scholarships_logs
+        <set>
+            <if test="openid != null">
+                openid = #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="present_id != null">
+                present_id = #{present_id,jdbcType=INTEGER},
+            </if>
+            <if test="type != null">
+                `type` = #{type,jdbcType=INTEGER},
+            </if>
+            <if test="create_at != null">
+                create_at = #{create_at,jdbcType=VARCHAR},
+            </if>
+            <if test="collection_date != null">
+                collection_date = #{collection_date,jdbcType=VARCHAR},
+            </if>
+            <if test="mkt_id != null">
+                mkt_id = #{mkt_id,jdbcType=INTEGER},
+            </if>
+            <if test="address != null">
+                address = #{address,jdbcType=VARCHAR},
+            </if>
+            <if test="coupon_number != null">
+                coupon_number = #{coupon_number,jdbcType=VARCHAR}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+</mapper>

+ 151 - 0
src/main/resources/mybatis/mapper/college/CollegePresentScholarshipsMapper.xml

@@ -0,0 +1,151 @@
+<?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.CollegePresentScholarshipsDao">
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegePresentScholarships">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="name" property="name" jdbcType="VARCHAR"/>
+        <result column="level" property="level" jdbcType="INTEGER"/>
+        <result column="type" property="type" jdbcType="INTEGER"/>
+        <result column="coupon_id" property="coupon_id" jdbcType="INTEGER"/>
+        <result column="scholarships" property="scholarships" jdbcType="INTEGER"/>
+        <result column="list_img_href" property="list_img_href" jdbcType="VARCHAR"/>
+        <result column="detail_img_href" property="detail_img_href" jdbcType="VARCHAR"/>
+        <result column="redeem_img_href" property="redeem_img_href" jdbcType="VARCHAR"/>
+        <result column="postage" property="postage" jdbcType="INTEGER"/>
+        <result column="count" property="count" jdbcType="VARCHAR"/>
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegePresentScholarships">
+        select
+        *
+        from college_present_scholarships
+        order by `level` asc ,id asc
+    </select>
+
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegePresentScholarships"
+            parameterType="java.lang.Integer">
+        select
+        *
+        from college_present_scholarships
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete from college_present_scholarships
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentScholarships">
+        insert into college_present_scholarships
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">
+                `name`,
+            </if>
+            <if test="level != null">
+                `level`,
+            </if>
+            <if test="type != null">
+                `type`,
+            </if>
+            <if test="coupon_id != null">
+                coupon_id,
+            </if>
+            <if test="scholarships != null">
+                scholarships,
+            </if>
+            <if test="list_img_href != null">
+                list_img_href,
+            </if>
+            <if test="detail_img_href != null">
+                detail_img_href,
+            </if>
+            <if test="redeem_img_href != null">
+                redeem_img_href,
+            </if>
+            <if test="postage != null">
+                postage,
+            </if>
+            <if test="count != null">
+                `count`
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="level != null">
+                #{level,jdbcType=INTEGER},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="coupon_id != null">
+                #{coupon_id,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null">
+                #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="list_img_href != null">
+                #{list_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="detail_img_href != null">
+                #{detail_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="redeem_img_href != null">
+                #{redeem_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="postage != null">
+                #{postage,jdbcType=INTEGER},
+            </if>
+            <if test="count != null">
+                #{count,jdbcType=INTEGER}
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegePresentScholarships">
+        update college_present_scholarships
+        <set>
+            <if test="name != null">
+                `name` = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="level != null">
+                `level` = #{level,jdbcType=INTEGER},
+            </if>
+            <if test="type != null">
+                `type` = #{type,jdbcType=INTEGER},
+            </if>
+            <if test="coupon_id != null">
+                coupon_id = #{coupon_id,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null">
+                scholarships = #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="list_img_href != null">
+                list_img_href = #{list_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="detail_img_href != null">
+                detail_img_href = #{detail_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="redeem_img_href != null">
+                redeem_img_href = #{redeem_img_href,jdbcType=VARCHAR},
+            </if>
+            <if test="postage != null">
+                postage = #{postage,jdbcType=INTEGER},
+            </if>
+            <if test="count != null">
+                `count` = #{count,jdbcType=INTEGER}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+    <update id="addCollegePresentScholarshipCount" parameterType="java.lang.Integer">
+        update college_present_scholarships
+        set `count` = `count` +1
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+</mapper>

+ 176 - 0
src/main/resources/mybatis/mapper/college/CollegeScholarshipsDetailMapper.xml

@@ -0,0 +1,176 @@
+<?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.CollegeScholarshipsDetailDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="openid" property="openid  " jdbcType="VARCHAR" />
+        <result column="event_code" property="event_code" jdbcType="INTEGER" />
+        <result column="type" property="type" jdbcType="VARCHAR" />
+        <result column="college_type" property="college_type" jdbcType="VARCHAR" />
+        <result column="college_id" property="college_id" jdbcType="INTEGER" />
+        <result column="scholarships" property="scholarships" jdbcType="INTEGER" />
+        <result column="account" property="account" jdbcType="INTEGER" />
+        <result column="create_at" property="create_at" jdbcType="VARCHAR" />
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" >
+        select
+        *
+        from college_scholarships_detail
+        order by id desc
+    </select>
+
+    <select id="queryUserScholarshipsLog" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" parameterType="java.lang.String" >
+        select
+        *
+        from college_scholarships_detail
+        where openid = #{ openid,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
+    <select id="checkFirst" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail">
+        select count(1)
+        from college_scholarships_detail
+        where  1=1
+        <if test="openid != null and openid !=''">
+            and openid = #{ openid,jdbcType=VARCHAR}
+        </if>
+        <if test="type != null and type !=''">
+            and `type` = #{type,jdbcType=VARCHAR}
+        </if>
+        <if test="event_code != null and event_code !=''">
+            and event_code = #{event_code,jdbcType=VARCHAR}
+        </if>
+        <if test="college_type != null and college_type !=''">
+            and college_type = #{college_type,jdbcType=VARCHAR}
+        </if>
+        <if test="college_id != null and college_id !=''">
+            and college_id = #{college_id,jdbcType=INTEGER}
+        </if>
+    </select>
+
+
+    <select id="queryCollegeScholarships" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail">
+        select *
+        from college_scholarships_detail
+        where  1=1
+        <if test="openid != null and openid !=''">
+            and openid = #{ openid,jdbcType=VARCHAR}
+        </if>
+        <if test="type != null and type !=''">
+            and `type` = #{type,jdbcType=VARCHAR}
+        </if>
+        <if test="event_code != null and event_code !=''">
+            and event_code = #{event_code,jdbcType=VARCHAR}
+        </if>
+        <if test="college_type != null and college_type !=''">
+            and college_type = #{college_type,jdbcType=VARCHAR}
+        </if>
+        <if test="college_id != null and college_id !=''">
+            and college_id = #{college_id,jdbcType=INTEGER}
+        </if>
+    </select>
+
+
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" parameterType="java.lang.Integer" >
+        select
+        *
+        from college_scholarships_detail
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+        delete from college_scholarships_detail
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" >
+        insert into college_scholarships_detail
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="openid != null" >
+                openid,
+            </if>
+            <if test="event_code != null" >
+                event_code,
+            </if>
+            <if test="type != null" >
+                `type`,
+            </if>
+            <if test="college_type != null" >
+                college_type,
+            </if>
+            <if test="college_id != null" >
+                college_id,
+            </if>
+            <if test="scholarships != null" >
+                scholarships,
+            </if>
+            <if test="account != null" >
+                account,
+            </if>
+            <if test="create_at != null" >
+                create_at
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="openid != null" >
+                #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="event_code != null" >
+                #{event_code,jdbcType=INTEGER},
+            </if>
+            <if test="type != null" >
+                #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="college_type != null" >
+                #{college_type,jdbcType=VARCHAR},
+            </if>
+            <if test="college_id != null" >
+                #{college_id,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null" >
+                #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="account != null" >
+                #{account,jdbcType=INTEGER},
+            </if>
+            <if test="create_at != null" >
+                #{create_at,jdbcType=VARCHAR}
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsDetail" >
+        update college_scholarships_detail
+        <set >
+            <if test="openid != null" >
+                openid = #{openid,jdbcType=VARCHAR},
+            </if>
+            <if test="event_code != null" >
+                event_code = #{event_code,jdbcType=INTEGER},
+            </if>
+            <if test="type != null" >
+                `type` = #{type ,jdbcType=VARCHAR},
+            </if>
+            <if test="college_type != null" >
+                college_type = #{college_type ,jdbcType=VARCHAR},
+            </if>
+            <if test="college_id != null" >
+                college_id = #{college_id,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null" >
+                scholarships = #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="account != null" >
+                account = #{account,jdbcType=INTEGER},
+            </if>
+            <if test="create_at != null" >
+                create_at = #{create_at,jdbcType=VARCHAR}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+</mapper>

+ 85 - 0
src/main/resources/mybatis/mapper/college/CollegeScholarshipsRuleMapper.xml

@@ -0,0 +1,85 @@
+<?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.CollegeScholarshipsRuleDao">
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegeScholarshipsRule">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="type" property="type" jdbcType="VARCHAR"/>
+        <result column="scholarships" property="scholarships" jdbcType="INTEGER"/>
+        <result column="first" property="first" jdbcType="INTEGER"/>
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getAll" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsRule">
+        select
+        *
+        from college_scholarships_rule
+        order by id desc
+    </select>
+
+    <select id="getScholarshipsRule" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsRule" parameterType="java.lang.String">
+        select
+        *
+        from college_scholarships_rule
+          where `type` = #{type,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
+
+
+    <select id="selectByPrimaryKey" resultType="com.ygj.yuemum.domain.college.CollegeScholarshipsRule"
+            parameterType="java.lang.Integer">
+        select
+        *
+        from college_scholarships_rule
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete from college_scholarships_rule
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsRule">
+        insert into college_scholarships_rule
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="type != null">
+                `type`,
+            </if>
+            <if test="scholarships != null">
+                scholarships,
+            </if>
+            <if test="first != null">
+                `first`
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null">
+                #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="first != null">
+                #{first,jdbcType=VARCHAR}
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeScholarshipsRule">
+        update college_scholarships_rule
+        <set>
+            <if test="type != null">
+                `type` = #{type,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships != null">
+                scholarships = #{scholarships,jdbcType=INTEGER},
+            </if>
+            <if test="first != null">
+                `first` = #{first,jdbcType=VARCHAR}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+</mapper>

+ 24 - 0
src/main/resources/mybatis/mapper/college/CollegeUserLevelMapper.xml

@@ -0,0 +1,24 @@
+<?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.CollegeUserLevelDao">
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.college.CollegeUserLevel">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="level" property="level" jdbcType="INTEGER"/>
+        <result column="start" property="start" jdbcType="INTEGER"/>
+        <result column="end" property="end" jdbcType="INTEGER"/>
+    </resultMap>
+    <!--获取所有数据-->
+
+    <select id="getUserLevel" resultType="com.ygj.yuemum.domain.college.CollegeUserLevel"  parameterType="java.lang.Integer">
+        SELECT
+            *
+        FROM
+            college_user_level
+        WHERE
+             #{level,jdbcType=INTEGER} BETWEEN START AND  `END`
+        order by `level` desc limit 1
+    </select>
+
+
+</mapper>

+ 31 - 3
src/main/resources/mybatis/mapper/college/CollegeUserPointsMapper.xml

@@ -7,6 +7,9 @@
         <result column="openid" property="openid" jdbcType="VARCHAR" />
         <result column="credit_total" property="credit_total" jdbcType="INTEGER" />
         <result column="credit_available" property="credit_available" jdbcType="INTEGER" />
+        <result column="scholarships_available" property="scholarships_available" jdbcType="INTEGER" />
+        <result column="scholarships_total" property="scholarships_total" jdbcType="INTEGER" />
+
     </resultMap>
     <!--获取所有数据-->
 
@@ -48,7 +51,13 @@
                 credit_total,
             </if>
             <if test="credit_available != null" >
-                credit_available
+                credit_available,
+            </if>
+            <if test="scholarships_available != null" >
+                scholarships_available,
+            </if>
+            <if test="scholarships_total != null" >
+                scholarships_total
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -59,7 +68,13 @@
                 #{credit_total,jdbcType=INTEGER},
             </if>
             <if test="credit_available != null" >
-                #{credit_available,jdbcType=INTEGER}
+                #{credit_available,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships_available != null" >
+                #{scholarships_available,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships_total != null" >
+                #{scholarships_total,jdbcType=INTEGER}
             </if>
         </trim>
     </insert>
@@ -74,7 +89,13 @@
                 credit_total = #{credit_total,jdbcType=INTEGER},
             </if>
             <if test="credit_available != null" >
-                credit_available = #{credit_available,jdbcType=INTEGER}
+                credit_available = #{credit_available,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships_available != null" >
+                scholarships_available = #{scholarships_available,jdbcType=INTEGER},
+            </if>
+            <if test="scholarships_total != null" >
+                scholarships_total = #{scholarships_total,jdbcType=INTEGER}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
@@ -88,4 +109,11 @@
         where openid = #{openid,jdbcType=VARCHAR}
     </update>
 
+    <update id="updateScholarships"  parameterType="com.ygj.yuemum.domain.college.CollegeUserPoints" >
+        update college_user_points
+        set scholarships_available = #{scholarships_available,jdbcType=INTEGER},
+        scholarships_total = #{scholarships_total,jdbcType=INTEGER}
+        where openid = #{openid,jdbcType=VARCHAR}
+    </update>
+
 </mapper>

+ 0 - 2
src/main/resources/mybatis/mapper/wxmini/WXPublicMapper.xml

@@ -20,7 +20,6 @@
           if(wp_issend = 999999,'不接收',fgetbranches_name (wp_issend)) wp_cityname
         FROM
             wx_public
-        ORDER BY id ASC
     </select>
 
     <update id="updateWXPublic" parameterType="com.ygj.yuemum.domain.wxmini.WXPublic" >
@@ -39,7 +38,6 @@
         from wx_public
         where
         wp_issend = #{wp_issend,jdbcType=INTEGER}
-        order by id asc
     </select>
 
 </mapper>