|
@@ -5,9 +5,11 @@ import com.ygj.yuemum.controller.global.WeChatInfoController;
|
|
import com.ygj.yuemum.dao.college.CollegeUserPointsDao;
|
|
import com.ygj.yuemum.dao.college.CollegeUserPointsDao;
|
|
import com.ygj.yuemum.domain.college.*;
|
|
import com.ygj.yuemum.domain.college.*;
|
|
import com.ygj.yuemum.domain.customer.CustomerBooking;
|
|
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.domain.wxmini.WXUser;
|
|
import com.ygj.yuemum.service.coupon.CouponCreateService;
|
|
import com.ygj.yuemum.service.coupon.CouponCreateService;
|
|
import com.ygj.yuemum.service.customer.CustomerBookingService;
|
|
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.service.wxmini.WXUserService;
|
|
import com.ygj.yuemum.utils.DateUtil;
|
|
import com.ygj.yuemum.utils.DateUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -17,6 +19,7 @@ import com.ygj.yuemum.utils.DistanceUtil;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashMap;
|
|
|
|
+import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -27,7 +30,7 @@ public class CollegeUserPointsService {
|
|
@Autowired
|
|
@Autowired
|
|
private WXUserService wxUserService;
|
|
private WXUserService wxUserService;
|
|
@Autowired
|
|
@Autowired
|
|
- private CollegePresentRuleService collegePresentRuleService;
|
|
|
|
|
|
+ private CollegePresentCreditService collegePresentCreditService;
|
|
@Autowired
|
|
@Autowired
|
|
private CollegeCurriculumCoreService collegeCurriculumCoreService;
|
|
private CollegeCurriculumCoreService collegeCurriculumCoreService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -46,6 +49,16 @@ public class CollegeUserPointsService {
|
|
private CollegeBookingService collegeBookingService;
|
|
private CollegeBookingService collegeBookingService;
|
|
@Autowired
|
|
@Autowired
|
|
private CollegeLearningDetailService collegeLearningDetailService;
|
|
private CollegeLearningDetailService collegeLearningDetailService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CollegeScholarshipsDetailService collegeScholarshipsDetailService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CollegePresentScholarshipsService collegePresentScholarshipsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CollegeUserLevelService collegeUserLevelService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WXMktInfoService wxMktInfoService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
public Integer LMP = Constant.LMP;
|
|
public Integer LMP = Constant.LMP;
|
|
@@ -77,11 +90,15 @@ public class CollegeUserPointsService {
|
|
return collegeUserPointsDao.updatePointsByTest(collegePointsDetail);
|
|
return collegeUserPointsDao.updatePointsByTest(collegePointsDetail);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public int updateScholarships(CollegeUserPoints collegePointsDetail) {
|
|
|
|
+ return collegeUserPointsDao.updateScholarships(collegePointsDetail);
|
|
|
|
+ }
|
|
|
|
+
|
|
public CollegeUserPoints queryOneUserPoints(String openid) {
|
|
public CollegeUserPoints queryOneUserPoints(String openid) {
|
|
return collegeUserPointsDao.queryOneUserPoints(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<>();
|
|
LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
|
|
WXUser wxUser = wxUserService.getWXUser(openid);
|
|
WXUser wxUser = wxUserService.getWXUser(openid);
|
|
tableData.put("stage", null);
|
|
tableData.put("stage", null);
|
|
@@ -154,36 +171,36 @@ public class CollegeUserPointsService {
|
|
point_available = collegeUserPoints.getCredit_total();
|
|
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", "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 customerBooking = new CustomerBooking();
|
|
customerBooking.setBk_branches_id(Integer.valueOf(city));
|
|
customerBooking.setBk_branches_id(Integer.valueOf(city));
|
|
customerBooking.setBk_phone(wxUser.getXu_phone());
|
|
customerBooking.setBk_phone(wxUser.getXu_phone());
|
|
customerBooking.setBk_date(ldf.format(new Date()));
|
|
customerBooking.setBk_date(ldf.format(new Date()));
|
|
customerBooking.setBk_type(6);
|
|
customerBooking.setBk_type(6);
|
|
- customerBooking.setBk_desc(collegePresentRule.getPresent_name());
|
|
|
|
|
|
+ customerBooking.setBk_desc(collegePresentCredit.getPresent_name());
|
|
customerBookingService.insertCustomerBooking(customerBooking);
|
|
customerBookingService.insertCustomerBooking(customerBooking);
|
|
weChatInfoController.WXSendBookingMessage(customerBooking);
|
|
weChatInfoController.WXSendBookingMessage(customerBooking);
|
|
- collegePointsDetail.setContext(collegePresentRule.getPresent_name());
|
|
|
|
|
|
+ collegePointsDetail.setContext(collegePresentCredit.getPresent_name());
|
|
} else {
|
|
} 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.setOpenid(openid);
|
|
collegePointsDetail.setDate(ldf.format(new Date()));
|
|
collegePointsDetail.setDate(ldf.format(new Date()));
|
|
collegePointsDetail.setEvent_code(4);
|
|
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);
|
|
collegePointsDetailService.addCollegePointsDetail(collegePointsDetail);
|
|
//更新学分 学分不减
|
|
//更新学分 学分不减
|
|
// collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue());
|
|
// collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue());
|
|
@@ -191,24 +208,40 @@ public class CollegeUserPointsService {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- tableData.put("present_received", collegePresentRules);
|
|
|
|
|
|
+ tableData.put("present_received", collegePresentCredits);
|
|
//常规课
|
|
//常规课
|
|
List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreService.queryCoreByStep(collegeCurriculumCoreQuery);
|
|
List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreService.queryCoreByStep(collegeCurriculumCoreQuery);
|
|
for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
|
|
for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
|
|
if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
|
|
if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
|
|
collegeCurriculumCore.setStatus("已完成");
|
|
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")) {
|
|
} else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
|
|
collegeCurriculumCore.setStatus("待完成");
|
|
collegeCurriculumCore.setStatus("待完成");
|
|
|
|
+ collegeCurriculumCore.setScholarships("0-100");
|
|
} else {
|
|
} else {
|
|
if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
|
|
if (collegeCurriculumCore.getC_step() >= DateUtil.getWeekDiff(dateNow, getDate)) {
|
|
collegeCurriculumCore.setStatus("待完成");
|
|
collegeCurriculumCore.setStatus("待完成");
|
|
|
|
+ collegeCurriculumCore.setScholarships("0-100");
|
|
} else {
|
|
} else {
|
|
collegeCurriculumCore.setStatus("未完成");
|
|
collegeCurriculumCore.setStatus("未完成");
|
|
|
|
+ collegeCurriculumCore.setScholarships("0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tableData.put("college_core", collegeCurriculumCores);
|
|
tableData.put("college_core", collegeCurriculumCores);
|
|
-
|
|
|
|
//实践课
|
|
//实践课
|
|
collegeCurriculumPracticeQuery.setDeadline(sdf.format(new Date()));
|
|
collegeCurriculumPracticeQuery.setDeadline(sdf.format(new Date()));
|
|
collegeCurriculumPracticeQuery.setCity(city);
|
|
collegeCurriculumPracticeQuery.setCity(city);
|
|
@@ -223,17 +256,32 @@ public class CollegeUserPointsService {
|
|
collegeCurriculumPractice.setStatus("已完成");
|
|
collegeCurriculumPractice.setStatus("已完成");
|
|
//已完成
|
|
//已完成
|
|
collegeCurriculumPractice.setLearningStatus("已完成");
|
|
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")) {
|
|
} else if (collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("1")) {
|
|
if (now.getTime() > deadLine.getTime()) {
|
|
if (now.getTime() > deadLine.getTime()) {
|
|
//未完成
|
|
//未完成
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
//已过期
|
|
//已过期
|
|
collegeCurriculumPractice.setLearningStatus("已过期");
|
|
collegeCurriculumPractice.setLearningStatus("已过期");
|
|
|
|
+ collegeCurriculumPractice.setScholarships("0");
|
|
} else {
|
|
} else {
|
|
//待完成
|
|
//待完成
|
|
collegeCurriculumPractice.setStatus("已报名");
|
|
collegeCurriculumPractice.setStatus("已报名");
|
|
//查看报名
|
|
//查看报名
|
|
collegeCurriculumPractice.setLearningStatus("查看报名");
|
|
collegeCurriculumPractice.setLearningStatus("查看报名");
|
|
|
|
+ collegeCurriculumPractice.setScholarships("0-100");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (now.getTime() > deadLine.getTime()) {
|
|
if (now.getTime() > deadLine.getTime()) {
|
|
@@ -241,16 +289,19 @@ public class CollegeUserPointsService {
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
//已过期
|
|
//已过期
|
|
collegeCurriculumPractice.setLearningStatus("已过期");
|
|
collegeCurriculumPractice.setLearningStatus("已过期");
|
|
|
|
+ collegeCurriculumPractice.setScholarships("0");
|
|
} else if (collegeCurriculumPractice.getPcount() >= 99) {
|
|
} else if (collegeCurriculumPractice.getPcount() >= 99) {
|
|
//未完成
|
|
//未完成
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
collegeCurriculumPractice.setStatus("未完成");
|
|
//已约满
|
|
//已约满
|
|
collegeCurriculumPractice.setLearningStatus("已约满");
|
|
collegeCurriculumPractice.setLearningStatus("已约满");
|
|
|
|
+ collegeCurriculumPractice.setScholarships("0-100");
|
|
} else {
|
|
} else {
|
|
//待完成
|
|
//待完成
|
|
collegeCurriculumPractice.setStatus("待完成");
|
|
collegeCurriculumPractice.setStatus("待完成");
|
|
//立即报名
|
|
//立即报名
|
|
collegeCurriculumPractice.setLearningStatus("立即报名");
|
|
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-已完成
|
|
if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
|
|
collegeCurriculumExperience.setStatus("已完成");
|
|
collegeCurriculumExperience.setStatus("已完成");
|
|
collegeCurriculumExperience.setLearningStatus("已完成");
|
|
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")) {
|
|
} else if (collegeCurriculumExperience.getStatus() != null && collegeCurriculumExperience.getStatus().equals("1")) {
|
|
collegeCurriculumExperience.setStatus("已预约");
|
|
collegeCurriculumExperience.setStatus("已预约");
|
|
collegeCurriculumExperience.setLearningStatus("查看预约");
|
|
collegeCurriculumExperience.setLearningStatus("查看预约");
|
|
|
|
+ collegeCurriculumExperience.setScholarships("0-100");
|
|
} else {
|
|
} else {
|
|
collegeCurriculumExperience.setStatus("未完成");
|
|
collegeCurriculumExperience.setStatus("未完成");
|
|
collegeCurriculumExperience.setLearningStatus("立即预约");
|
|
collegeCurriculumExperience.setLearningStatus("立即预约");
|
|
|
|
+ collegeCurriculumExperience.setScholarships("0-100");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tableData.put("college_experience", collegeCurriculumExperiences);
|
|
tableData.put("college_experience", collegeCurriculumExperiences);
|
|
@@ -289,6 +355,8 @@ public class CollegeUserPointsService {
|
|
public int getPointsByOffline(String openid, String c_code, String lat, String lon) {
|
|
public int getPointsByOffline(String openid, String c_code, String lat, String lon) {
|
|
//51-参数错误 52-没有预约 53-不在范围 54-已完成
|
|
//51-参数错误 52-没有预约 53-不在范围 54-已完成
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ String college_type = "";
|
|
|
|
+ Integer id = null;
|
|
if (c_code.indexOf("College") == -1) {
|
|
if (c_code.indexOf("College") == -1) {
|
|
return 51; //参数错误
|
|
return 51; //参数错误
|
|
}
|
|
}
|
|
@@ -299,15 +367,19 @@ public class CollegeUserPointsService {
|
|
int credit = 0;
|
|
int credit = 0;
|
|
if (collegeBookingService.checkBooking(collegeBooking) != null) {
|
|
if (collegeBookingService.checkBooking(collegeBooking) != null) {
|
|
if (c_code.substring(7, 1) == "P") {
|
|
if (c_code.substring(7, 1) == "P") {
|
|
|
|
+ college_type = "practice";
|
|
CollegeCurriculumPractice collegeCurriculumPractice = collegeCurriculumPracticeService.getPracticeByCode(c_code);
|
|
CollegeCurriculumPractice collegeCurriculumPractice = collegeCurriculumPracticeService.getPracticeByCode(c_code);
|
|
lat_l = collegeCurriculumPractice.getMi_latitude();
|
|
lat_l = collegeCurriculumPractice.getMi_latitude();
|
|
lon_l = collegeCurriculumPractice.getMi_longitude();
|
|
lon_l = collegeCurriculumPractice.getMi_longitude();
|
|
credit = collegeCurriculumPractice.getCredit();
|
|
credit = collegeCurriculumPractice.getCredit();
|
|
|
|
+ id = collegeCurriculumPractice.getId();
|
|
} else if (c_code.substring(7, 1) == "E") {
|
|
} else if (c_code.substring(7, 1) == "E") {
|
|
|
|
+ college_type = "experience";
|
|
CollegeCurriculumExperience collegeCurriculumExperience = collegeCurriculumExperienceService.getExperienceByCode(c_code.substring(8, c_code.length()));
|
|
CollegeCurriculumExperience collegeCurriculumExperience = collegeCurriculumExperienceService.getExperienceByCode(c_code.substring(8, c_code.length()));
|
|
lat_l = collegeCurriculumExperience.getLatitude();
|
|
lat_l = collegeCurriculumExperience.getLatitude();
|
|
lon_l = collegeCurriculumExperience.getLongitude();
|
|
lon_l = collegeCurriculumExperience.getLongitude();
|
|
credit = collegeCurriculumExperience.getCredit();
|
|
credit = collegeCurriculumExperience.getCredit();
|
|
|
|
+ id = collegeCurriculumExperience.getId();
|
|
} else {
|
|
} else {
|
|
return 51; //参数错误
|
|
return 51; //参数错误
|
|
}
|
|
}
|
|
@@ -342,6 +414,8 @@ public class CollegeUserPointsService {
|
|
collegeUserPointsNew.setCredit_total(collegeUserPoints.getCredit_total() + credit);
|
|
collegeUserPointsNew.setCredit_total(collegeUserPoints.getCredit_total() + credit);
|
|
collegeUserPointsNew.setCredit_available(collegeUserPoints.getCredit_available() + credit);
|
|
collegeUserPointsNew.setCredit_available(collegeUserPoints.getCredit_available() + credit);
|
|
}
|
|
}
|
|
|
|
+ //增加奖学金
|
|
|
|
+ collegeScholarshipsDetailService.addScholarships(openid, "learning",college_type, id, null, null);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
} else {
|
|
} 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|