用户开课管理
This commit is contained in:
@@ -990,6 +990,7 @@ public class BuyOrderController {
|
|||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
}
|
}
|
||||||
|
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";延期(虚拟币购买:"+orderEntity.getOrderSn()+")");
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
@@ -1003,6 +1004,7 @@ public class BuyOrderController {
|
|||||||
// cal.setTime(new Date());
|
// cal.setTime(new Date());
|
||||||
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||||
|
userCourseBuyEntity.setCome("虚拟币购买:"+orderEntity.getOrderSn());
|
||||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,6 +225,12 @@ public class ClassController {
|
|||||||
return R.ok().put("result",classEntityService.getClassByUser(params));
|
return R.ok().put("result",classEntityService.getClassByUser(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//加入小班前查询用户买课情况
|
||||||
|
@RequestMapping("/getUserCourseBuy")
|
||||||
|
public R getUserCourseBuy(@RequestBody Map<String,Object> params){
|
||||||
|
return classEntityService.getUserCourseBuy(params);
|
||||||
|
}
|
||||||
|
|
||||||
//加入小班
|
//加入小班
|
||||||
@RequestMapping("/joinClass")
|
@RequestMapping("/joinClass")
|
||||||
public R joinClass(@RequestBody Map<String,Object> params){
|
public R joinClass(@RequestBody Map<String,Object> params){
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class UserCourseBuyEntity {
|
|||||||
|
|
||||||
private Integer days;
|
private Integer days;
|
||||||
|
|
||||||
|
private String come;
|
||||||
|
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
|
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public interface ClassEntityService extends IService<ClassEntity> {
|
|||||||
|
|
||||||
ClassEntity getClassByUser(Map<String, Object> params);
|
ClassEntity getClassByUser(Map<String, Object> params);
|
||||||
|
|
||||||
|
R getUserCourseBuy(Map<String ,Object> params);
|
||||||
|
|
||||||
R joinClass(Map<String ,Object> params);
|
R joinClass(Map<String ,Object> params);
|
||||||
|
|
||||||
void quitClass(Map<String ,Object> params);
|
void quitClass(Map<String ,Object> params);
|
||||||
|
|||||||
@@ -642,6 +642,32 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R getUserCourseBuy(Map<String, Object> params) {
|
||||||
|
ClassEntity classEntity = this.baseMapper.selectById(params.get("classId").toString());
|
||||||
|
MyUserEntity user = ShiroUtils.getUser();
|
||||||
|
String msg = "";
|
||||||
|
if ("0".equals(user.getVip())||"3".equals(user.getVip())){
|
||||||
|
//不是vip查询每门课是否购买
|
||||||
|
List<ClassCourse> courses = classCourseDao.selectList(new LambdaQueryWrapper<ClassCourse>()
|
||||||
|
.eq(ClassCourse::getModelId,classEntity.getModelId()));
|
||||||
|
for (ClassCourse classCourse:courses){
|
||||||
|
List<UserCourseBuyEntity> ucb = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||||
|
.eq(UserCourseBuyEntity::getUserId,user.getId())
|
||||||
|
.eq(UserCourseBuyEntity::getCourseId,classCourse.getCourseId()));
|
||||||
|
if (ucb.size() == 0){
|
||||||
|
CourseEntity courseEntity = courseDao.selectById(classCourse.getCourseId());
|
||||||
|
if (StringUtils.isEmpty(msg)){
|
||||||
|
msg+=courseEntity.getTitle()+"";
|
||||||
|
}else {
|
||||||
|
msg+=","+courseEntity.getTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok(msg);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R joinClass(Map<String, Object> params) {
|
public R joinClass(Map<String, Object> params) {
|
||||||
ClassEntity classEntity = this.baseMapper.selectById(params.get("classId").toString());
|
ClassEntity classEntity = this.baseMapper.selectById(params.get("classId").toString());
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.peanut.modules.master.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.peanut.common.utils.DateUtils;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||||
|
import com.peanut.modules.common.entity.CourseEntity;
|
||||||
|
import com.peanut.modules.common.entity.MyUserEntity;
|
||||||
|
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||||
|
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户开课管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController("masterUserCourseBuy")
|
||||||
|
@RequestMapping("master/userCourseBuy")
|
||||||
|
public class UserCourseBuyController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserCourseBuyService userCourseBuyService;
|
||||||
|
|
||||||
|
@RequestMapping("/listByPage")
|
||||||
|
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||||
|
MPJLambdaWrapper<UserCourseBuyEntity> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.leftJoin(MyUserEntity.class, MyUserEntity::getId, UserCourseBuyEntity::getUserId);
|
||||||
|
wrapper.leftJoin(CourseEntity.class, CourseEntity::getId, UserCourseBuyEntity::getCourseId);
|
||||||
|
wrapper.leftJoin(CourseCatalogueEntity.class, CourseCatalogueEntity::getId, UserCourseBuyEntity::getCatalogueId);
|
||||||
|
wrapper.select("t.id,t.user_id userId,t.course_id courseId,t.catalogue_id catalogueId,t.create_time createTime," +
|
||||||
|
"t.come,t.days,t.start_time startTime,t.end_time endTime,t.del_flag expire,t1.tel,t2.title courseName,t3.title catalogueName");
|
||||||
|
if (StringUtils.isNotEmpty(params.get("userInfo").toString())) {
|
||||||
|
wrapper.and(t->t.like(MyUserEntity::getName,params.get("userInfo")).or().like(MyUserEntity::getNickname,params.get("userInfo"))
|
||||||
|
.or().like(MyUserEntity::getTel,params.get("userInfo")).or().like(MyUserEntity::getEmail,params.get("userInfo")));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(params.get("courseName").toString())) {
|
||||||
|
wrapper.like(CourseEntity::getTitle,params.get("courseName"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(params.get("come").toString())) {
|
||||||
|
wrapper.like(UserCourseBuyEntity::getCome,params.get("come"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(params.get("expire").toString())) {
|
||||||
|
wrapper.eq(UserCourseBuyEntity::getDelFlag,params.get("expire"));
|
||||||
|
}
|
||||||
|
//查询出过期课程
|
||||||
|
wrapper.disableLogicDel();
|
||||||
|
wrapper.orderByDesc(UserCourseBuyEntity::getDelFlag);
|
||||||
|
wrapper.orderByDesc(UserCourseBuyEntity::getCreateTime);
|
||||||
|
Page<Map<String, Object>> page = userCourseBuyService.pageMaps(new Page<>(
|
||||||
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
|
return R.ok().put("result", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/insertUserCourseBuy")
|
||||||
|
public R insertUserCourseBuy(@RequestBody UserCourseBuyEntity userCourseBuyEntity) {
|
||||||
|
userCourseBuyService.save(userCourseBuyEntity);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/delayUserCourseBuy")
|
||||||
|
public R delayUserCourseBuy(@RequestBody Map<String, Object> params) {
|
||||||
|
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyService.getById(params.get("id").toString());
|
||||||
|
int days = Integer.parseInt(params.get("days").toString());
|
||||||
|
userCourseBuyEntity.setDays(userCourseBuyEntity.getDays()+days);
|
||||||
|
if (userCourseBuyEntity.getEndTime()!=null){
|
||||||
|
userCourseBuyEntity.setEndTime(DateUtils.addDateDays(userCourseBuyEntity.getEndTime(),days));
|
||||||
|
}
|
||||||
|
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";延期(管理员操作:"+days+","+DateUtils.format(new Date(),"yyyyMMdd")+")");
|
||||||
|
userCourseBuyService.updateById(userCourseBuyEntity);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/expireUserCourseBuy")
|
||||||
|
@Transactional
|
||||||
|
public R expireUserCourseBuy(@RequestBody Map<String, Object> params) {
|
||||||
|
UserCourseBuyEntity userCourseBuyEntity = userCourseBuyService.getById(params.get("id").toString());
|
||||||
|
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";终止(管理员操作)");
|
||||||
|
if (userCourseBuyEntity.getStartTime()!=null){
|
||||||
|
userCourseBuyEntity.setStartTime(new Date());
|
||||||
|
}
|
||||||
|
userCourseBuyEntity.setEndTime(new Date());
|
||||||
|
userCourseBuyService.updateById(userCourseBuyEntity);
|
||||||
|
userCourseBuyService.removeById(params.get("id").toString());
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.master.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||||
|
|
||||||
|
public interface UserCourseBuyService extends IService<UserCourseBuyEntity> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.master.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.UserCourseBuyDao;
|
||||||
|
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||||
|
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("masterUserCourseBuyService")
|
||||||
|
public class UserCourseBuyServiceImpl extends ServiceImpl<UserCourseBuyDao, UserCourseBuyEntity> implements UserCourseBuyService {
|
||||||
|
}
|
||||||
@@ -264,6 +264,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
}
|
}
|
||||||
|
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";延期(支付宝购买:"+orderEntity.getOrderSn()+")");
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
@@ -277,6 +278,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||||||
// cal.setTime(new Date());
|
// cal.setTime(new Date());
|
||||||
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||||
|
userCourseBuyEntity.setCome("支付宝购买:"+orderEntity.getOrderSn());
|
||||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
calendar.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
userCourseBuyEntity.setEndTime(calendar.getTime());
|
userCourseBuyEntity.setEndTime(calendar.getTime());
|
||||||
}
|
}
|
||||||
|
userCourseBuyEntity.setCome(userCourseBuyEntity.getCome()+";延期(微信购买:"+order.getOrderSn()+")");
|
||||||
userCourseBuyDao.updateById(userCourseBuyEntity);
|
userCourseBuyDao.updateById(userCourseBuyEntity);
|
||||||
}else{
|
}else{
|
||||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||||
@@ -219,6 +220,7 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
// cal.setTime(new Date());
|
// cal.setTime(new Date());
|
||||||
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
|
||||||
// userCourseBuyEntity.setEndTime(cal.getTime());
|
// userCourseBuyEntity.setEndTime(cal.getTime());
|
||||||
|
userCourseBuyEntity.setCome("微信购买:"+order.getOrderSn());
|
||||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
cal.setTime(new Date());
|
cal.setTime(new Date());
|
||||||
cal.add(Calendar.DAY_OF_MONTH,30);
|
cal.add(Calendar.DAY_OF_MONTH,30);
|
||||||
userCourseBuyEntity.setEndTime(cal.getTime());
|
userCourseBuyEntity.setEndTime(cal.getTime());
|
||||||
|
userCourseBuyEntity.setCome("免费领取课程");
|
||||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user