package com.ygj.yuemum.service.college; import com.ygj.yuemum.component.Constant; 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; import org.springframework.stereotype.Service; 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 public class CollegeUserPointsService { @Autowired private CollegeUserPointsDao collegeUserPointsDao; @Autowired private WXUserService wxUserService; @Autowired private CollegePresentCreditService collegePresentCreditService; @Autowired private CollegeCurriculumCoreService collegeCurriculumCoreService; @Autowired private CollegeCurriculumPracticeService collegeCurriculumPracticeService; @Autowired private CollegeCurriculumExperienceService collegeCurriculumExperienceService; @Autowired private CollegePointsDetailService collegePointsDetailService; @Autowired private CustomerBookingService customerBookingService; @Autowired private WeChatInfoController weChatInfoController; @Autowired private CouponCreateService couponCreateService; @Autowired 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; public Integer AGE = Constant.AGE; public List getCollegeUserPoints() { List collegeUserPoints = collegeUserPointsDao.getAll(); return collegeUserPoints; } public CollegeUserPoints getCollegeUserPoint(Integer id) { CollegeUserPoints collegeUserPoints = collegeUserPointsDao.selectByPrimaryKey(id); return collegeUserPoints; } public int addCollegeUserPoints(CollegeUserPoints collegeUserPoints) { return collegeUserPointsDao.insertSelective(collegeUserPoints); } public int deleteCollegeUserPoints(Integer id) { return collegeUserPointsDao.deleteByPrimaryKey(id); } public int updateCollegeUserPoints(CollegeUserPoints collegeUserPoints) { return collegeUserPointsDao.updateByPrimaryKeySelective(collegeUserPoints); } public int updatePointsByTest(CollegePointsDetail collegePointsDetail) { return collegeUserPointsDao.updatePointsByTest(collegePointsDetail); } public int updateScholarships(CollegeUserPoints collegePointsDetail) { return collegeUserPointsDao.updateScholarships(collegePointsDetail); } public CollegeUserPoints queryOneUserPoints(String openid) { return collegeUserPointsDao.queryOneUserPoints(openid); } public LinkedHashMap queryUserPoints(String openid, String city) { LinkedHashMap tableData = new LinkedHashMap<>(); WXUser wxUser = wxUserService.getWXUser(openid); tableData.put("stage", null); tableData.put("stage_date", null); if (wxUser != null && wxUser.getXu_phone() != null) { if (wxUser.getXu_content_type() != null && wxUser.getXu_content_date() != null) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat ldf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dateNow = new Date(); Date getDate = sdf.parse(wxUser.getXu_content_date()); CollegeCurriculumCore collegeCurriculumCoreQuery = new CollegeCurriculumCore(); CollegeCurriculumPractice collegeCurriculumPracticeQuery = new CollegeCurriculumPractice(); CollegeCurriculumExperience collegeCurriculumExperienceQuery = new CollegeCurriculumExperience(); collegeCurriculumCoreQuery.setOpenid(openid); collegeCurriculumPracticeQuery.setOpenid(openid); collegeCurriculumExperienceQuery.setOpenid(openid); CollegePointsDetail collegePointsDetail = new CollegePointsDetail(); if (wxUser.getXu_content_type().equals("B01")) { //育儿 if (dateNow.getTime() < getDate.getTime()) { //还没出生 return tableData; } else { if (DateUtil.getMonthDiff(dateNow, getDate) + 1 > AGE) { return tableData; } else { tableData.put("stage_step", DateUtil.getMonthDiff(dateNow, getDate) + 1); collegeCurriculumCoreQuery.setC_type("B01"); collegeCurriculumCoreQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1); collegeCurriculumPracticeQuery.setC_type("B01"); collegeCurriculumPracticeQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1); collegeCurriculumExperienceQuery.setC_type("B01"); collegeCurriculumExperienceQuery.setC_step(DateUtil.getMonthDiff(dateNow, getDate) + 1); } } } else if (wxUser.getXu_content_type().equals("P01")) { //孕周 if (dateNow.getTime() < getDate.getTime()) { if (LMP - DateUtil.getWeekDiff(dateNow, getDate) < 0) { return tableData; //还没怀孕 } else { tableData.put("stage_step", LMP - DateUtil.getWeekDiff(dateNow, getDate)); collegeCurriculumCoreQuery.setC_type("P01"); collegeCurriculumCoreQuery.setC_step(LMP - DateUtil.getWeekDiff(dateNow, getDate)); collegeCurriculumPracticeQuery.setC_type("P01"); collegeCurriculumPracticeQuery.setC_step(LMP - DateUtil.getWeekDiff(dateNow, getDate)); collegeCurriculumExperienceQuery.setC_type("P01"); collegeCurriculumExperienceQuery.setC_step(LMP - DateUtil.getWeekDiff(dateNow, getDate)); } } else { return tableData; } } else { return tableData; } tableData.put("stage", wxUser.getXu_content_type()); tableData.put("stage_date", wxUser.getXu_content_date()); tableData.put("avatar_url", wxUser.getXu_avatarUrl()); //查询学分 int point_available = 0; CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid); if (collegeUserPoints == null) { CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints(); collegeUserPointsNew.setOpenid(openid); collegeUserPointsNew.setCredit_total(0); collegeUserPointsNew.setCredit_available(0); collegeUserPointsDao.insertSelective(collegeUserPointsNew); tableData.put("credit", 0); } else { tableData.put("credit", collegeUserPoints.getCredit_total()); point_available = collegeUserPoints.getCredit_total(); } //查询奖学金 tableData.put("scholarships", collegeUserPoints.getScholarships_available()); //礼品领取情况 List collegePresentCredits = collegePresentCreditService.queryUserReceived(openid); for (CollegePresentCredit collegePresentCredit : collegePresentCredits) { if (collegePresentCredit.getReceived() != 1 && point_available >= collegePresentCredit.getValue()) { //返回礼品内容 tableData.put("surprise", "true"); tableData.put("surprise_type", collegePresentCredit.getType()); tableData.put("surprise_name", collegePresentCredit.getPresent_name()); //自动发放礼品 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(collegePresentCredit.getPresent_name()); customerBookingService.insertCustomerBooking(customerBooking); weChatInfoController.WXSendBookingMessage(customerBooking); collegePointsDetail.setContext(collegePresentCredit.getPresent_name()); } else { //优惠券领取接口 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(collegePresentCredit.getValue() * -1); collegePointsDetail.setRule_id(collegePresentCredit.getId()); collegePointsDetailService.addCollegePointsDetail(collegePointsDetail); //更新学分 学分不减 // collegeUserPoints.setCredit_available(collegeUserPoints.getCredit_available() - collegePresentRule.getValue()); // collegeUserPointsDao.updateByPrimaryKeySelective(collegeUserPoints); break; } } tableData.put("present_received", collegePresentCredits); //常规课 List 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); collegeCurriculumPracticeQuery.setStartdate(sdf.format(new Date())); List collegeCurriculumPractices = collegeCurriculumPracticeService.queryPracticeByStep(collegeCurriculumPracticeQuery); //判断日期 for (CollegeCurriculumPractice collegeCurriculumPractice : collegeCurriculumPractices) { Date deadLine = ldf.parse(collegeCurriculumPractice.getDeadline()); Date now = new Date(); if (collegeCurriculumPractice.getLearningStatus() != null && collegeCurriculumPractice.getLearningStatus().equals("9")) { //已完成 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()) { //未完成 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"); } } } tableData.put("college_practice", collegeCurriculumPractices); //体验课 collegeCurriculumExperienceQuery.setCity(city); List collegeCurriculumExperiences = collegeCurriculumExperienceService.queryExperienceByStep(collegeCurriculumExperienceQuery); for (CollegeCurriculumExperience collegeCurriculumExperience : collegeCurriculumExperiences) { 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); return tableData; } catch (Exception ex) { ex.printStackTrace(); return tableData; } } else { tableData.put("status", "5"); //没有设置日期 return tableData; } } else { tableData.put("status", "6"); //没有授权手机号 return tableData; } } 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; //参数错误 } CollegeBooking collegeBooking = new CollegeBooking(); collegeBooking.setOpenid(openid); collegeBooking.setCollege_code(c_code.substring(8, c_code.length())); String lat_l, lon_l; 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; //参数错误 } DistanceUtil distanceUtil = new DistanceUtil(); double distance = distanceUtil.GetDistance(Double.parseDouble(lat_l), Double.parseDouble(lon_l), Double.parseDouble(lat), Double.parseDouble(lon)); if (distance > 500) { return 53; //不在范围内 } else { //判断是否已完成 CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail(); collegeLearningDetail.setOpen_id(openid); collegeLearningDetail.setC_code(c_code.substring(8, c_code.length())); CollegeLearningDetail collegeLearningDetailC = collegeLearningDetailService.checkCorePositive(collegeLearningDetail); if (collegeLearningDetailC.getStatus() != 9) { collegeLearningDetailC.setDate(sdf.format(new Date())); collegeLearningDetailC.setStatus(9); collegeLearningDetailC.setCredit(credit); collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetailC); } else { return 54; //已完成 } //判断是否已经学习 增加学分 CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid); if (collegeUserPoints == null) { CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints(); collegeUserPointsNew.setOpenid(openid); collegeUserPointsNew.setCredit_total(credit); collegeUserPointsNew.setCredit_available(credit); } else { CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints(); collegeUserPointsNew.setOpenid(openid); 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 { return 52; //没有预约 } } public LinkedHashMap queryRedeemIndex(String openid) { LinkedHashMap userInfo = new LinkedHashMap<>(); LinkedHashMap returnInfo = new LinkedHashMap<>(); List presentInfoTemp = new LinkedList<>(); WXUser wxUser = wxUserService.getWXUser(openid); CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid); CollegeUserLevel collegeUserLevel; if(collegeUserPoints == null) { //新增用户 CollegeUserPoints collegeUserPointsNew = new CollegeUserPoints(); collegeUserPointsNew.setOpenid(openid); collegeUserPointsNew.setCredit_available(0); collegeUserPointsNew.setCredit_total(0); collegeUserPointsNew.setScholarships_available(0); collegeUserPointsNew.setScholarships_total(0); collegeUserPointsDao.insertSelective(collegeUserPointsNew); collegeUserLevel = collegeUserLevelService.getUserLevel(0); collegeUserPoints = collegeUserPointsNew; } else { 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 = collegePresentScholarshipsService.getCollegePresentScholarships(); for (CollegePresentScholarships collegePresentScholarship : collegePresentScholarships) { LinkedHashMap presents = new LinkedHashMap<>(); //通过等级判断是否适合商品 presents.put("id",collegePresentScholarship.getId()); 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 queryRedeem(Integer presentId) { LinkedHashMap returnInfo = new LinkedHashMap<>(); CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(presentId); returnInfo.put("detail_img_href",collegePresentScholarships.getDetail_img_href()); return returnInfo; } public LinkedHashMap queryRedeemDetail(Integer presentId,String openid) { LinkedHashMap returnInfo = new LinkedHashMap<>(); CollegePresentScholarships collegePresentScholarships = collegePresentScholarshipsService.getCollegePresentScholarship(presentId); CollegeUserPoints collegeUserPoints = collegeUserPointsDao.queryOneUserPoints(openid); CollegeUserLevel collegeUserLevelTemp = collegeUserLevelService.getUserLevel(collegeUserPoints.getCredit_available()); int level = 0; if (collegeUserLevelTemp != null) { level = collegeUserLevelTemp.getLevel(); } if(collegeUserPoints == null || collegePresentScholarships == null) { returnInfo.put("error", "未找到信息"); } else { CollegeUserLevel collegeUserLevel = collegeUserLevelService.getUserLevelDesc(collegePresentScholarships.getLevel()); returnInfo.put("level",collegePresentScholarships.getLevel()); returnInfo.put("levelDesc",collegeUserLevel.getDesc()); returnInfo.put("presentDesc",collegePresentScholarships.getDesc()); 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.getLevel() > level) { returnInfo.put("redeem", false); } else { returnInfo.put("redeem", true); } if(collegePresentScholarships.getType() == 2) { List wxMktInfo = wxMktInfoService.getMktInfos(null); returnInfo.put("mktInfo",wxMktInfo); } } return returnInfo; } public LinkedHashMap userRedeem(CollegePresentScholarshipsLogs collegePresentScholarshipsLogs) { LinkedHashMap 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; } } }