Merge remote-tracking branch 'origin/zcc'
This commit is contained in:
@@ -2,10 +2,12 @@ package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.excel.ExcelUtil;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.ClassExamOption;
|
||||
import com.peanut.modules.common.entity.ClassExamSubject;
|
||||
import com.peanut.modules.common.entity.ClassExamUser;
|
||||
import com.peanut.modules.common.entity.ClassModel;
|
||||
import com.peanut.modules.common.service.ClassExamOptionService;
|
||||
import com.peanut.modules.common.service.ClassExamService;
|
||||
import com.peanut.modules.common.service.ClassExamSubjectService;
|
||||
@@ -176,8 +178,7 @@ public class ClassExamController {
|
||||
//考试中的试卷
|
||||
@RequestMapping("/examingPaper")
|
||||
public R examingPaper(){
|
||||
ClassExamUser classExamUser = classExamService.examingPaper();
|
||||
return R.ok().put("classExamUser",classExamUser);
|
||||
return classExamService.examingPaper();
|
||||
}
|
||||
|
||||
//提交选项
|
||||
@@ -204,8 +205,7 @@ public class ClassExamController {
|
||||
//试卷详情
|
||||
@RequestMapping("/getExamPaperInfo")
|
||||
public R getExamPaperInfo(@RequestBody Map<String,Object> params){
|
||||
Object examPaper = classExamService.getExamPaperInfo(params);
|
||||
return R.ok().put("examPaper",examPaper);
|
||||
return classExamService.getExamPaperInfo(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ public class ClassModel {
|
||||
|
||||
private Integer examDays;//考试周时长
|
||||
|
||||
private String examProportion;//考试题型比例
|
||||
|
||||
private Integer examTime;//考试时长分钟
|
||||
|
||||
private Integer isQuestion;
|
||||
private Integer questionScore;
|
||||
private Integer isTask;
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ClassExamService extends IService<ClassExam> {
|
||||
|
||||
R generateExamPaper(Map<String,Object> params);
|
||||
|
||||
ClassExamUser examingPaper();
|
||||
R examingPaper();
|
||||
|
||||
void submitOption(Map<String,Object> params);
|
||||
|
||||
@@ -40,6 +40,6 @@ public interface ClassExamService extends IService<ClassExam> {
|
||||
|
||||
Object getExamPaperList(Map<String,Object> params);
|
||||
|
||||
Object getExamPaperInfo(Map<String,Object> params);
|
||||
R getExamPaperInfo(Map<String,Object> params);
|
||||
|
||||
}
|
||||
|
||||
@@ -1118,6 +1118,11 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
double staticScore = 2.5;
|
||||
if(classModel.getIsExam()==1){
|
||||
BigDecimal examScore = new BigDecimal(map.get("examScore").toString());
|
||||
BigDecimal totalExamScore = new BigDecimal(Integer.parseInt(classModel.getExamProportion().split(":")[0])
|
||||
+Integer.parseInt(classModel.getExamProportion().split(":")[1]));
|
||||
examScore = examScore.divide(totalExamScore);
|
||||
examScore = examScore.multiply(new BigDecimal(classModel.getExamScore()));
|
||||
examScore = examScore.setScale(2,RoundingMode.HALF_UP);
|
||||
map.put("examScore",examScore);
|
||||
userScore = userScore.add(examScore);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
@Autowired
|
||||
private ClassEntityDao classEntityDao;
|
||||
@Autowired
|
||||
private ClassModelDao classModelDao;
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
@@ -146,6 +148,8 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
return R.error("存在正在考试,请结束再试");
|
||||
}
|
||||
ClassEntity classEntity = classEntityDao.selectById(params.get("classId").toString());
|
||||
ClassModel classModel = classModelDao.selectById(classEntity.getModelId());
|
||||
int examTime = classModel.getExamTime();
|
||||
MPJLambdaWrapper<ClassCourse> courseWrapper = new MPJLambdaWrapper<>();
|
||||
courseWrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassCourse::getModelId);
|
||||
courseWrapper.leftJoin(ClassEntity.class,ClassEntity::getModelId,ClassModel::getId);
|
||||
@@ -157,10 +161,8 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
List<Map<String,Object>> sList = new ArrayList<>();
|
||||
List<Map<String,Object>> mList = new ArrayList<>();
|
||||
if (courseList.size() > 0) {
|
||||
int stotal = 60;//单选题总数
|
||||
int mtotal = 40;//多选题总数
|
||||
// int stotal = 5;//单选题总数
|
||||
// int mtotal = 5;//多选题总数
|
||||
int stotal = Integer.parseInt(classModel.getExamProportion().split(":")[0]);//单选题总数
|
||||
int mtotal = Integer.parseInt(classModel.getExamProportion().split(":")[1]);//多选题总数
|
||||
int snum = (int)Math.floor(stotal/courseList.size());
|
||||
int mnum = (int)Math.floor(mtotal/courseList.size());
|
||||
for (ClassCourse classCourse:courseList){
|
||||
@@ -229,17 +231,25 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
DelayQueueConfig.COMMON_EXCHANGE,
|
||||
DelayQueueConfig.COMMON_ROUTING_KEY,
|
||||
"examSubmit"+","+classExamUser.getId(),
|
||||
messagePostProcessor(2*60*60*1000+3000)//3秒延迟
|
||||
messagePostProcessor(examTime*60*1000+3000)//3秒延迟
|
||||
);
|
||||
return R.ok().put("examPaper",resultList).put("id",classExamUser.getId()).put("startTime",classExamUser.getStartTime());
|
||||
return R.ok().put("examPaper",resultList).put("id",classExamUser.getId())
|
||||
.put("startTime",classExamUser.getStartTime()).put("planEndTime",DateUtils.addDateMinutes(startTime,examTime));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassExamUser examingPaper() {
|
||||
public R examingPaper() {
|
||||
ClassExamUser classExamUser = classExamUserDao.selectOne(new LambdaQueryWrapper<ClassExamUser>()
|
||||
.eq(ClassExamUser::getUserId,ShiroUtils.getUId()).eq(ClassExamUser::getScoreSuccess,0));
|
||||
return classExamUser;
|
||||
if (classExamUser!=null){
|
||||
ClassEntity classEntity = classEntityDao.selectById(classExamUser.getClassId());
|
||||
ClassModel classModel = classModelDao.selectById(classEntity.getModelId());
|
||||
return R.ok().put("classExamUser",classExamUser)
|
||||
.put("planEndTime",DateUtils.addDateMinutes(classExamUser.getStartTime(),classModel.getExamTime()));
|
||||
}else {
|
||||
return R.ok().put("classExamUser",null).put("planEndTime",null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -310,9 +320,12 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getExamPaperInfo(Map<String, Object> params) {
|
||||
public R getExamPaperInfo(Map<String, Object> params) {
|
||||
ClassExamUser classExamUser = classExamUserDao.selectById(params.get("id").toString());
|
||||
return classExamUser;
|
||||
ClassEntity classEntity = classEntityDao.selectById(classExamUser.getClassId());
|
||||
ClassModel classModel = classModelDao.selectById(classEntity.getModelId());
|
||||
return R.ok().put("examPaper",classExamUser)
|
||||
.put("planEndTime",DateUtils.addDateMinutes(classExamUser.getStartTime(),classModel.getExamTime()));
|
||||
}
|
||||
|
||||
private MessagePostProcessor messagePostProcessor(long date) {
|
||||
|
||||
@@ -3,8 +3,10 @@ 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.R;
|
||||
import com.peanut.modules.book.service.ShopProductBookService;
|
||||
import com.peanut.modules.common.entity.BookEntity;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.entity.ShopProductBookEntity;
|
||||
import com.peanut.modules.common.entity.ShopProductCourseEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.common.vo.CourseCatalogueVo;
|
||||
@@ -16,6 +18,7 @@ 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.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -53,6 +56,13 @@ public class ShopProductController {
|
||||
return R.ok().put("detail",detail);
|
||||
}
|
||||
|
||||
@RequestMapping("/addProduct")
|
||||
public R addProduct(@RequestBody ShopProduct shopProduct){
|
||||
shopProduct.setCreateTime(new Date());
|
||||
shopProductService.save(shopProduct);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/editProductDetail")
|
||||
public R editProductDetail(@RequestBody ShopProduct shopProduct){
|
||||
shopProductService.updateById(shopProduct);
|
||||
|
||||
Reference in New Issue
Block a user