自考
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.peanut.modules.common.controller;
|
package com.peanut.modules.common.controller;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.peanut.common.excel.ExcelUtil;
|
import com.peanut.common.excel.ExcelUtil;
|
||||||
import com.peanut.common.utils.DateUtils;
|
import com.peanut.common.utils.DateUtils;
|
||||||
@@ -29,6 +30,9 @@ public class ClassExamController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClassExamService classExamService;
|
private ClassExamService classExamService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClassExamUserService classExamUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClassExamSubjectService classExamSubjectService;
|
private ClassExamSubjectService classExamSubjectService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -232,6 +236,29 @@ public class ClassExamController {
|
|||||||
return R.ok().put("examPaper",examPaper);
|
return R.ok().put("examPaper",examPaper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自考试卷列表
|
||||||
|
@RequestMapping("/getZKExamPaperList")
|
||||||
|
public R getZKExamPaperList(@RequestBody Map<String,Object> params){
|
||||||
|
List<ClassExamUser> ZKExamUserList = classExamUserService.list(new LambdaQueryWrapper<ClassExamUser>()
|
||||||
|
.eq(ClassExamUser::getType,"2")
|
||||||
|
.eq(ClassExamUser::getUserId,ShiroUtils.getUId())
|
||||||
|
.eq(ClassExamUser::getRelationId,params.get("courseId"))
|
||||||
|
.orderByAsc(ClassExamUser::getId));
|
||||||
|
return R.ok().put("ZKExamUserList",ZKExamUserList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//自考试卷列表
|
||||||
|
@RequestMapping("/getNextZKTime")
|
||||||
|
public R getNextZKTime(@RequestBody Map<String,Object> params){
|
||||||
|
List<ClassExamUser> ZKExamUserList = classExamUserService.list(new LambdaQueryWrapper<ClassExamUser>()
|
||||||
|
.eq(ClassExamUser::getType,"2")
|
||||||
|
.eq(ClassExamUser::getUserId,ShiroUtils.getUId())
|
||||||
|
.eq(ClassExamUser::getRelationId,params.get("courseId"))
|
||||||
|
.orderByDesc(ClassExamUser::getId));
|
||||||
|
Date nextTime = DateUtils.addDateDays(ZKExamUserList.get(0).getStartTime(),183);
|
||||||
|
return R.ok().put("nextZKTime",nextTime).put("nextLongTime",nextTime.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
//试卷详情
|
//试卷详情
|
||||||
@RequestMapping("/getExamPaperInfo")
|
@RequestMapping("/getExamPaperInfo")
|
||||||
public R getExamPaperInfo(@RequestBody Map<String,Object> params){
|
public R getExamPaperInfo(@RequestBody Map<String,Object> params){
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ public class CouponController {
|
|||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CouponHistoryService couponHistoryService;
|
private CouponHistoryService couponHistoryService;
|
||||||
@Autowired
|
|
||||||
private BuyOrderService buyOrderService;
|
|
||||||
@Autowired
|
|
||||||
private BuyOrderProductService buyOrderProductService;
|
|
||||||
|
|
||||||
//优惠卷列表
|
//优惠卷列表
|
||||||
@RequestMapping("/getCouponList")
|
@RequestMapping("/getCouponList")
|
||||||
@@ -154,7 +150,15 @@ public class CouponController {
|
|||||||
int couponId = (int)params.get("couponId");
|
int couponId = (int)params.get("couponId");
|
||||||
int userId = (int)params.get("userId");
|
int userId = (int)params.get("userId");
|
||||||
int getType = (int)params.get("getType");
|
int getType = (int)params.get("getType");
|
||||||
return couponService.insertCouponHistory(couponId,userId,getType);
|
String remark = params.get("remark").toString();
|
||||||
|
return couponService.insertCouponHistory(couponId,userId,getType,remark);
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除用户优惠卷
|
||||||
|
@RequestMapping("/delCouponHistory")
|
||||||
|
public R delCouponHistory(@RequestBody Map<String,Object> params){
|
||||||
|
couponHistoryService.removeById(params.get("couponHistoryId").toString());
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
//当前优惠卷可用商品
|
//当前优惠卷可用商品
|
||||||
|
|||||||
@@ -32,9 +32,15 @@ public class UserCertificateController {
|
|||||||
|
|
||||||
//获取证书列表
|
//获取证书列表
|
||||||
@RequestMapping("/getUserCertificateList")
|
@RequestMapping("/getUserCertificateList")
|
||||||
public R getUserCertificateList() {
|
public R getUserCertificateList(@RequestBody Map<String,Object> params) {
|
||||||
LambdaQueryWrapper<UserCertificate> wrapper = new LambdaQueryWrapper();
|
LambdaQueryWrapper<UserCertificate> wrapper = new LambdaQueryWrapper();
|
||||||
wrapper.eq(UserCertificate::getUserId, ShiroUtils.getUId());
|
wrapper.eq(UserCertificate::getUserId, ShiroUtils.getUId());
|
||||||
|
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
||||||
|
wrapper.eq(UserCertificate::getType, params.get("type"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(params.get("courseId").toString())){
|
||||||
|
wrapper.eq(UserCertificate::getCourseId, params.get("courseId"));
|
||||||
|
}
|
||||||
return R.ok().put("certificateList",userCertificateService.list(wrapper));
|
return R.ok().put("certificateList",userCertificateService.list(wrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public class CouponHistory {
|
|||||||
//获取类型 0 后台赠送 1 主动获取
|
//获取类型 0 后台赠送 1 主动获取
|
||||||
private Integer getType;
|
private Integer getType;
|
||||||
|
|
||||||
|
//备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
//使用状态 0 未使用 1 已使用 2 已过期
|
//使用状态 0 未使用 1 已使用 2 已过期
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public interface CouponService extends IService<CouponEntity> {
|
|||||||
|
|
||||||
CouponEntity setRangeList(CouponEntity couponEntity);
|
CouponEntity setRangeList(CouponEntity couponEntity);
|
||||||
|
|
||||||
R insertCouponHistory(int couponId, int userId,int getType);
|
R insertCouponHistory(int couponId, int userId,int getType,String remark);
|
||||||
|
|
||||||
List<CouponHistory> getCouponListPayment(Map<String,Object> params);
|
List<CouponHistory> getCouponListPayment(Map<String,Object> params);
|
||||||
|
|
||||||
|
|||||||
@@ -70,19 +70,22 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R insertCouponHistory(int couponId, int userId,int getType) {
|
public R insertCouponHistory(int couponId, int userId,int getType,String remark) {
|
||||||
CouponEntity couponEntity = couponDao.selectById(couponId);
|
CouponEntity couponEntity = couponDao.selectById(couponId);
|
||||||
int historyCount = couponHistoryDao.selectCount(new LambdaQueryWrapper<CouponHistory>()
|
int historyCount = couponHistoryDao.selectCount(new LambdaQueryWrapper<CouponHistory>()
|
||||||
.eq(CouponHistory::getCouponId,couponId));
|
.eq(CouponHistory::getCouponId,couponId));
|
||||||
|
//是否超出总发行量
|
||||||
if (historyCount<couponEntity.getTotalCirculation()){
|
if (historyCount<couponEntity.getTotalCirculation()){
|
||||||
List<CouponHistory> historyList = couponHistoryDao.selectList(new LambdaQueryWrapper<CouponHistory>()
|
List<CouponHistory> historyList = couponHistoryDao.selectList(new LambdaQueryWrapper<CouponHistory>()
|
||||||
.eq(CouponHistory::getUserId,userId)
|
.eq(CouponHistory::getUserId,userId)
|
||||||
.eq(CouponHistory::getCouponId,couponId));
|
.eq(CouponHistory::getCouponId,couponId));
|
||||||
|
//是否超出可持有张数
|
||||||
if (historyList.size()<couponEntity.getLimitedCollar()){
|
if (historyList.size()<couponEntity.getLimitedCollar()){
|
||||||
CouponHistory couponHistory = new CouponHistory();
|
CouponHistory couponHistory = new CouponHistory();
|
||||||
couponHistory.setCouponId(couponId);
|
couponHistory.setCouponId(couponId);
|
||||||
couponHistory.setUserId(userId);
|
couponHistory.setUserId(userId);
|
||||||
couponHistory.setGetType(getType);
|
couponHistory.setGetType(getType);
|
||||||
|
couponHistory.setRemark(remark);
|
||||||
couponHistory.setEffectType(couponEntity.getEffectType());
|
couponHistory.setEffectType(couponEntity.getEffectType());
|
||||||
if (couponEntity.getEffectType()==1){
|
if (couponEntity.getEffectType()==1){
|
||||||
couponHistory.setStartTime(new Date());
|
couponHistory.setStartTime(new Date());
|
||||||
|
|||||||
Reference in New Issue
Block a user