修改排序
This commit is contained in:
@@ -15,8 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@@ -80,13 +78,25 @@ public class CouponController {
|
||||
wrapper.orderByAsc(CouponHistory::getStatus);
|
||||
wrapper.orderByDesc(CouponHistory::getCreateTime);
|
||||
Page<CouponHistory> couponList = couponHistoryService.page(new Page<>(page, limit), wrapper);
|
||||
for (CouponHistory ch:couponList.getRecords()){
|
||||
ch.setCouponEntity(couponService.getByIdSetRange(ch.getCouponId()));
|
||||
}
|
||||
return R.ok().put("couponList",couponList);
|
||||
}
|
||||
|
||||
//用户优惠劵详情
|
||||
@RequestMapping("/getCouponHistoryInfo")
|
||||
public R getCouponHistoryInfo(@RequestBody Map<String,Object> params){
|
||||
CouponHistory CouponHistory = couponHistoryService.getById(Integer.parseInt(params.get("id").toString()));
|
||||
CouponEntity couponEntity = couponService.setRangeList(couponService.getByIdSetRange(CouponHistory.getCouponId()));
|
||||
CouponHistory.setCouponEntity(couponEntity);
|
||||
return R.ok().put("couponHistory",CouponHistory);
|
||||
}
|
||||
|
||||
//优惠劵详情
|
||||
@RequestMapping("/getCouponInfo")
|
||||
public R getCouponInfo(@RequestBody Map<String,Object> params){
|
||||
CouponEntity couponEntity = couponService.getById(Integer.parseInt(params.get("id").toString()));
|
||||
CouponEntity couponEntity = couponService.getByIdSetRange(Integer.parseInt(params.get("id").toString()));
|
||||
couponService.setRangeList(couponEntity);
|
||||
return R.ok().put("couponEntity",couponEntity);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
|
||||
|
||||
public interface CouponService extends IService<CouponEntity> {
|
||||
|
||||
CouponEntity getByIdSetRange(int id);
|
||||
|
||||
CouponEntity setRangeList(CouponEntity couponEntity);
|
||||
|
||||
R insertCouponHistory(int couponId, int userId,int getType);
|
||||
|
||||
@@ -324,10 +324,15 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
if (classExamUsers>0){
|
||||
return R.error("有学员正在考试,请稍后再试");
|
||||
}
|
||||
int replys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
int taskReplys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.ne(ClassTaskAndQuesReply::getScoreSuccess,2));
|
||||
int questionReplys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.eq(ClassTaskAndQuesReply::getType,1)
|
||||
.eq(ClassTaskAndQuesReply::getScoreSuccess,0));
|
||||
if (replys>0){
|
||||
if (taskReplys>0||questionReplys>0){
|
||||
return R.error("学员打分未完成,请完成打分后结班");
|
||||
}
|
||||
classEntity.setState("2");
|
||||
@@ -811,6 +816,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.eq(ClassModel::getType,params.get("type"));
|
||||
}
|
||||
wrapper.eq(ClassUser::getUserId,ShiroUtils.getUId());
|
||||
wrapper.orderByDesc(ClassEntity::getId);
|
||||
List<Map<String,Object>> list = this.baseMapper.selectMaps(wrapper);
|
||||
if (list.size() > 0){
|
||||
for (Map<String,Object> map:list){
|
||||
|
||||
@@ -331,7 +331,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
List<ClassExamUser> classExamUserList = classExamUserDao.selectList(new LambdaQueryWrapper<ClassExamUser>()
|
||||
.eq(ClassExamUser::getRelationId,params.get("classId"))
|
||||
.eq(ClassExamUser::getUserId,params.get("userId"))
|
||||
.orderByDesc(ClassExamUser::getScore));
|
||||
.orderByAsc(ClassExamUser::getId));
|
||||
return classExamUserList;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.peanut.modules.common.dao.CourseDao;
|
||||
import com.peanut.modules.common.dao.CourseMedicineDao;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import com.peanut.modules.common.entity.CouponHistory;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseMedicine;
|
||||
import com.peanut.modules.common.service.CouponService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -38,16 +40,28 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public CouponEntity getByIdSetRange(int id) {
|
||||
CouponEntity couponEntity = this.getBaseMapper().selectById(id);
|
||||
return setRangeList(couponEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponEntity setRangeList(CouponEntity couponEntity) {
|
||||
List<Object> list = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(couponEntity.getRangeInfo())){
|
||||
String[] arr = couponEntity.getRangeInfo().split(",");
|
||||
for (String str : arr) {
|
||||
if (couponEntity.getCouponRange()==1){
|
||||
list.add(courseDao.selectById(Integer.parseInt(str)));
|
||||
}else {
|
||||
list.add(courseMedicineDao.selectById(Integer.parseInt(str)));
|
||||
if (couponEntity.getCouponRange()!=0){
|
||||
if (StringUtils.isNotEmpty(couponEntity.getRangeInfo())){
|
||||
String[] arr = couponEntity.getRangeInfo().split(",");
|
||||
for (String str : arr) {
|
||||
if (couponEntity.getCouponRange()==1){
|
||||
list.add(courseDao.selectOne(new LambdaQueryWrapper<CourseEntity>()
|
||||
.eq(CourseEntity::getId,Integer.parseInt(str))
|
||||
.select(CourseEntity::getId,CourseEntity::getTitle)));
|
||||
}else if(couponEntity.getCouponRange()==2){
|
||||
list.add(courseMedicineDao.selectOne(new LambdaQueryWrapper<CourseMedicine>()
|
||||
.eq(CourseMedicine::getId,Integer.parseInt(str))
|
||||
.select(CourseMedicine::getId,CourseMedicine::getTitle)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user