更新java17,springboot3.3.9,maven3.9.10,
This commit is contained in:
@@ -3,33 +3,25 @@ package com.peanut.modules.common.controller;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.promeg.pinyinhelper.Pinyin;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.dao.ClassExamUserDao;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.*;
|
||||
import com.peanut.modules.medical.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
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 javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -267,7 +259,7 @@ public class ClassController {
|
||||
ClassEntity classEntity = classEntityService.getById(classTask.getClassId());
|
||||
if (classEntity.getId()>168){
|
||||
ClassModel classModel = classModelService.getById(classEntity.getModelId());
|
||||
int taskCount = classTaskService.count(new LambdaQueryWrapper<ClassTask>()
|
||||
Long taskCount = classTaskService.count(new LambdaQueryWrapper<ClassTask>()
|
||||
.eq(ClassTask::getClassId,classEntity.getId())
|
||||
.eq(ClassTask::getType,"2")
|
||||
.eq(ClassTask::getUserId,ShiroUtils.getUId()));
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@RestController("commonCoupon")
|
||||
@@ -59,8 +58,9 @@ public class CouponController {
|
||||
Page<CouponEntity> couponPage = couponService.page(new Page<>(page, limit), wrapper);
|
||||
for (CouponEntity couponEntity : couponPage.getRecords()) {
|
||||
couponService.setRangeList(couponEntity);
|
||||
couponEntity.setGrantCount(couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponEntity.getId())));
|
||||
Long count = couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponEntity.getId()));
|
||||
couponEntity.setGrantCount(count.intValue());
|
||||
}
|
||||
return R.ok().put("couponPage",couponPage);
|
||||
}
|
||||
@@ -110,8 +110,9 @@ public class CouponController {
|
||||
public R getCouponInfo(@RequestBody Map<String,Object> params){
|
||||
CouponEntity couponEntity = couponService.getByIdSetRange(Integer.parseInt(params.get("id").toString()));
|
||||
couponService.setRangeList(couponEntity);
|
||||
couponEntity.setGrantCount(couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponEntity.getId())));
|
||||
Long count = couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponEntity.getId()));
|
||||
couponEntity.setGrantCount(count.intValue());
|
||||
return R.ok().put("couponEntity",couponEntity);
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public class CouponController {
|
||||
@Transactional
|
||||
public R delCoupon(@RequestBody Map<String,Object> params){
|
||||
int couponId = Integer.parseInt(params.get("id").toString());
|
||||
int count = couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
Long count = couponHistoryService.count(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponId));
|
||||
if (count>0){
|
||||
return R.error("已有用户拥有优惠券");
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.service.TransactionDetailsService;
|
||||
import com.peanut.modules.common.dao.CourseToMedicineDao;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.*;
|
||||
import com.peanut.modules.common.service.JfTransactionDetailsService;
|
||||
@@ -27,8 +26,6 @@ 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.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
@@ -102,10 +99,10 @@ public class CourseRelearnController {
|
||||
if (cc != null) {
|
||||
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
||||
if (courseEntity != null) {
|
||||
int mCount = courseToMedicalService.count(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId,courseEntity.getId()));
|
||||
int sCount = courseToSociologyService.count(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId,courseEntity.getId()));
|
||||
int pCount = courseToPsycheService.count(new LambdaQueryWrapper<CourseToPsyche>().eq(CourseToPsyche::getCourseId,courseEntity.getId()));
|
||||
int tCount = courseToTaihumedService.count(new LambdaQueryWrapper<CourseToTaihumed>().eq(CourseToTaihumed::getCourseId,courseEntity.getId()));
|
||||
Long mCount = courseToMedicalService.count(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId,courseEntity.getId()));
|
||||
Long sCount = courseToSociologyService.count(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId,courseEntity.getId()));
|
||||
Long pCount = courseToPsycheService.count(new LambdaQueryWrapper<CourseToPsyche>().eq(CourseToPsyche::getCourseId,courseEntity.getId()));
|
||||
Long tCount = courseToTaihumedService.count(new LambdaQueryWrapper<CourseToTaihumed>().eq(CourseToTaihumed::getCourseId,courseEntity.getId()));
|
||||
if (mCount>0||sCount > 0||pCount > 0||tCount > 0){
|
||||
List<UserCourseBuyEntity> list = userCourseBuyService.list(new MPJLambdaWrapper<UserCourseBuyEntity>()
|
||||
.disableLogicDel()//查询出已删除数据
|
||||
@@ -134,10 +131,10 @@ public class CourseRelearnController {
|
||||
if (cc != null) {
|
||||
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
||||
if (courseEntity != null){
|
||||
int mCount = courseToMedicalService.count(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId,courseEntity.getId()));
|
||||
int sCount = courseToSociologyService.count(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId,courseEntity.getId()));
|
||||
int pCount = courseToPsycheService.count(new LambdaQueryWrapper<CourseToPsyche>().eq(CourseToPsyche::getCourseId,courseEntity.getId()));
|
||||
int tCount = courseToTaihumedService.count(new LambdaQueryWrapper<CourseToTaihumed>().eq(CourseToTaihumed::getCourseId,courseEntity.getId()));
|
||||
Long mCount = courseToMedicalService.count(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getCourseId,courseEntity.getId()));
|
||||
Long sCount = courseToSociologyService.count(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getCourseId,courseEntity.getId()));
|
||||
Long pCount = courseToPsycheService.count(new LambdaQueryWrapper<CourseToPsyche>().eq(CourseToPsyche::getCourseId,courseEntity.getId()));
|
||||
Long tCount = courseToTaihumedService.count(new LambdaQueryWrapper<CourseToTaihumed>().eq(CourseToTaihumed::getCourseId,courseEntity.getId()));
|
||||
if (mCount>0||sCount > 0||pCount > 0||tCount > 0){
|
||||
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(ShopProductCourseEntity.class,ShopProductCourseEntity::getProductId,ShopProduct::getProductId);
|
||||
|
||||
@@ -85,8 +85,8 @@ public class ExpressController {
|
||||
Page<ExpressOrder> expressOrderPage = new Page<>(currentPage, pageSize);
|
||||
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
int totalDataSize = expressOrderService.count(expressOrderQueryWrapper);
|
||||
int totalPage = totalDataSize / pageSize + 1;
|
||||
Long totalDataSize = expressOrderService.count(expressOrderQueryWrapper);
|
||||
int totalPage = totalDataSize.intValue() / pageSize + 1;
|
||||
Page<ExpressOrder> page = expressOrderService.page(expressOrderPage, expressOrderQueryWrapper);
|
||||
List<ExpressOrder> expressOrderList = page.getRecords();
|
||||
List<PrintTemplateVo> data = new ArrayList<>();
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -92,7 +92,7 @@ public class TrainingClassController {
|
||||
if (m!=null&m.containsKey("fee")){
|
||||
trainingClass.setFinalFee(m.get("fee").toString());
|
||||
}
|
||||
int count = trainingToUserService.count(new LambdaQueryWrapper<TrainingToUser>()
|
||||
Long count = trainingToUserService.count(new LambdaQueryWrapper<TrainingToUser>()
|
||||
.eq(TrainingToUser::getUserId, ShiroUtils.getUId())
|
||||
.eq(TrainingToUser::getTrainingId,trainingClass.getId()));
|
||||
if (count > 0) {
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.transaction.Transactional;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -3,10 +3,6 @@ package com.peanut.modules.common.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.xml.soap.Text;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.peanut.modules.common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class UserAppAuthorEntity {
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -270,29 +270,29 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
ClassModel classModel = classModelDao.selectById(classEntity.getModelId());
|
||||
//开班校验
|
||||
int monitorCount = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"1"));
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"1")).intValue();
|
||||
if (monitorCount<1){
|
||||
return R.error("请先设置班长");
|
||||
}
|
||||
int dmonitorCount = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"2"));
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"2")).intValue();
|
||||
if (dmonitorCount<1){
|
||||
return R.error("请先设置副班长");
|
||||
}
|
||||
int studyCount = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"3"));
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"3")).intValue();
|
||||
if (studyCount<1){
|
||||
return R.error("请先设置学习委员");
|
||||
}
|
||||
int commentCount = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"4"));
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"4")).intValue();
|
||||
if (commentCount<3){
|
||||
return R.error("请先设置3位评分员");
|
||||
}
|
||||
|
||||
if (classModel.getIsTask()==1){
|
||||
int taskCount = classTaskDao.selectCount(new LambdaQueryWrapper<ClassTask>()
|
||||
.eq(ClassTask::getClassId,classEntity.getId()).eq(ClassTask::getType,"0"));
|
||||
.eq(ClassTask::getClassId,classEntity.getId()).eq(ClassTask::getType,"0")).intValue();
|
||||
double allWeek = Math.ceil((classModel.getDays())/7.0)-2;
|
||||
if (taskCount<allWeek){
|
||||
return R.error("请至少发布"+allWeek+"个任务。");
|
||||
@@ -300,7 +300,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
}
|
||||
|
||||
int studentCount = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"0"));
|
||||
.eq(ClassUser::getClassId,classEntity.getId()).eq(ClassUser::getRole,"0")).intValue();
|
||||
if (studentCount<classEntity.getNumber()){
|
||||
return R.error("学生人数未满");
|
||||
}
|
||||
@@ -311,12 +311,12 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
for (ClassCourse classCourse : classCourses) {
|
||||
CourseEntity course = courseDao.selectById(classCourse.getCourseId());
|
||||
int singleCount = classExamSubjectDao.selectCount(new LambdaQueryWrapper<ClassExamSubject>()
|
||||
.eq(ClassExamSubject::getCourseId,classCourse.getCourseId()).eq(ClassExamSubject::getType,"0"));
|
||||
.eq(ClassExamSubject::getCourseId,classCourse.getCourseId()).eq(ClassExamSubject::getType,"0")).intValue();
|
||||
if (singleCount<Integer.parseInt(classModel.getExamProportion().split(":")[0])){
|
||||
return R.error(course.getTitle()+"-单选题不足,请补充题库");
|
||||
}
|
||||
int multipleCount = classExamSubjectDao.selectCount(new LambdaQueryWrapper<ClassExamSubject>()
|
||||
.eq(ClassExamSubject::getCourseId,classCourse.getCourseId()).eq(ClassExamSubject::getType,"1"));
|
||||
.eq(ClassExamSubject::getCourseId,classCourse.getCourseId()).eq(ClassExamSubject::getType,"1")).intValue();
|
||||
if (multipleCount<Integer.parseInt(classModel.getExamProportion().split(":")[1])){
|
||||
return R.error(course.getTitle()+"-多选题不足,请补充题库");
|
||||
}
|
||||
@@ -341,7 +341,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
for (CourseCatalogueEntity catalog:catalogues){
|
||||
int ucbCount = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId,classUser.getUserId())
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId()));
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId())).intValue();
|
||||
if (ucbCount == 0){
|
||||
flag = true;
|
||||
CourseEntity c = courseDao.selectById(classCourse.getCourseId());
|
||||
@@ -541,7 +541,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int count = classUserDao.selectCount(
|
||||
new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId())
|
||||
.eq(ClassUser::getRole,0));
|
||||
.eq(ClassUser::getRole,0)).intValue();
|
||||
if (count > 0){
|
||||
return R.error("还有学员存在,删除失败。");
|
||||
}else {
|
||||
@@ -599,7 +599,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
for (CourseCatalogueEntity catalog:catalogues){
|
||||
int ucbCount = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId,user.getId())
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId()));
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId())).intValue();
|
||||
if (ucbCount > 0){
|
||||
sb.append(course.getTitle()+"-"+catalog.getTitle()+"已购买 ");//空格用来分割多门课程
|
||||
}else {
|
||||
@@ -729,7 +729,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
for (CourseCatalogueEntity catalog:catalogues){
|
||||
int ucbCount = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId,user.getId())
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId()));
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,catalog.getId())).intValue();
|
||||
if (ucbCount == 0){
|
||||
CourseEntity courseEntity = courseDao.selectById(classCourse.getCourseId());
|
||||
if (StringUtils.isEmpty(msg)){
|
||||
@@ -760,7 +760,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int count = userCertificateDao.selectCount(new LambdaQueryWrapper<UserCertificate>()
|
||||
.and(t->t.eq(UserCertificate::getType,"A").or().eq(UserCertificate::getType,"B"))
|
||||
.eq(UserCertificate::getCourseId,classCourse.getCourseId())
|
||||
.eq(UserCertificate::getUserId,ShiroUtils.getUId()));
|
||||
.eq(UserCertificate::getUserId,ShiroUtils.getUId())).intValue();
|
||||
if (count>0){
|
||||
return R.error("已获得相关课程证书");
|
||||
}
|
||||
@@ -780,7 +780,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
//判断开班人数
|
||||
int count = classUserDao.selectCount(new LambdaQueryWrapper<ClassUser>()
|
||||
.eq(ClassUser::getClassId,classEntity.getId())
|
||||
.eq(ClassUser::getRole,"0"));
|
||||
.eq(ClassUser::getRole,"0")).intValue();
|
||||
if (count<classEntity.getNumber()){
|
||||
ClassUser classUser = new ClassUser();
|
||||
classUser.setClassId(classEntity.getId());
|
||||
@@ -914,11 +914,11 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
for (ClassTask classTask:classTaskPage.getRecords()){
|
||||
int alreadyReply = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId()));
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId())).intValue();
|
||||
int userNoCount = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId())
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\"")).intValue();
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("setGiveHomeWorkNumber",alreadyReply);
|
||||
result.put("userNoCount",userNoCount);
|
||||
@@ -1001,7 +1001,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int count = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,classTask.getId())
|
||||
.eq(ClassTaskAndQuesReply::getUserId,ShiroUtils.getUId()));
|
||||
.eq(ClassTaskAndQuesReply::getUserId,ShiroUtils.getUId())).intValue();
|
||||
if (count > 0) {
|
||||
classTask.setReply(true);
|
||||
}else {
|
||||
@@ -1016,7 +1016,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int c = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,classTaskAndQuesReply.getType())
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,classTaskAndQuesReply.getRelationId())
|
||||
.eq(ClassTaskAndQuesReply::getUserId,classTaskAndQuesReply.getUserId()));
|
||||
.eq(ClassTaskAndQuesReply::getUserId,classTaskAndQuesReply.getUserId())).intValue();
|
||||
if (c > 0) {
|
||||
return 2;
|
||||
}
|
||||
@@ -1161,14 +1161,14 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int task0Replys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\"")).intValue();
|
||||
if (task0Replys > 0){
|
||||
info += "任务";
|
||||
}
|
||||
int quesReplys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getType,1)
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\"")).intValue();
|
||||
if (quesReplys > 0){
|
||||
info += "思考题";
|
||||
}
|
||||
@@ -1181,7 +1181,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
.eq(ClassTaskAndQuesReply::getType,0)
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.eq(ClassTaskAndQuesReply::getRelationId,ct.getId())
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
|
||||
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\"")).intValue();
|
||||
if (task1Replys > 0){
|
||||
flag = true;
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
int expReplys = classTaskDao.selectCount(new LambdaQueryWrapper<ClassTask>()
|
||||
.eq(ClassTask::getClassId,cu.getClassId())
|
||||
.eq(ClassTask::getType,2)
|
||||
.notLike(ClassTask::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
|
||||
.notLike(ClassTask::getScoreInfo,"\""+ShiroUtils.getUId()+"\"")).intValue();
|
||||
if (expReplys > 0){
|
||||
info += "心得";
|
||||
}
|
||||
@@ -1450,7 +1450,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassCourse::getModelId);
|
||||
wrapper.eq(ClassModel::getId,classModel.getId());
|
||||
wrapper.ne(CourseCatalogueChapterEntity::getQuestions,"");
|
||||
int count = courseCatalogueChapterDao.selectCount(wrapper);
|
||||
int count = courseCatalogueChapterDao.selectCount(wrapper).intValue();
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
questionScore = questionScore.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
questionScore = questionScore.multiply(new BigDecimal(classModel.getQuestionScore()));
|
||||
@@ -1466,7 +1466,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
MPJLambdaWrapper<ClassTask> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ClassTask::getClassId,classEntity.getId());
|
||||
wrapper.eq(ClassTask::getType,"0");
|
||||
int count = classTaskDao.selectCount(wrapper);
|
||||
int count = classTaskDao.selectCount(wrapper).intValue();
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
task0Score = task0Score.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
task0Score = task0Score.multiply(new BigDecimal(classModel.getTaskScore()));
|
||||
@@ -1482,7 +1482,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
MPJLambdaWrapper<ClassTask> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ClassTask::getClassId,classEntity.getId());
|
||||
wrapper.eq(ClassTask::getType,"1");
|
||||
int count = classTaskDao.selectCount(wrapper);
|
||||
int count = classTaskDao.selectCount(wrapper).intValue();
|
||||
BigDecimal totalScore = new BigDecimal(staticScore*count);
|
||||
task1Score = task1Score.divide(totalScore,2, RoundingMode.HALF_UP);
|
||||
task1Score = task1Score.multiply(new BigDecimal(classModel.getMedicalcaseScore()));
|
||||
@@ -1600,17 +1600,17 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
//结班限制
|
||||
int classExamUsers = classExamUserDao.selectCount(new LambdaQueryWrapper<ClassExamUser>()
|
||||
.eq(ClassExamUser::getRelationId,classEntity.getId())
|
||||
.eq(ClassExamUser::getScoreSuccess,0));
|
||||
.eq(ClassExamUser::getScoreSuccess,0)).intValue();
|
||||
if (classExamUsers>0){
|
||||
return R.error("有学员正在考试,请稍后再试");
|
||||
}
|
||||
int task0AndQuesReplys = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
|
||||
.eq(ClassTaskAndQuesReply::getClassId,classEntity.getId())
|
||||
.lt(ClassTaskAndQuesReply::getScoreSuccess,3));
|
||||
.lt(ClassTaskAndQuesReply::getScoreSuccess,3)).intValue();
|
||||
int task1AndExpReplys = classTaskDao.selectCount(new LambdaQueryWrapper<ClassTask>()
|
||||
.eq(ClassTask::getClassId,classEntity.getId())
|
||||
.eq(ClassTask::getType,2)
|
||||
.lt(ClassTask::getScoreSuccess,3));
|
||||
.lt(ClassTask::getScoreSuccess,3)).intValue();
|
||||
if (task0AndQuesReplys>0||task1AndExpReplys>0){
|
||||
return R.error("学员打分未完成,请完成打分后结班");
|
||||
}
|
||||
|
||||
@@ -6,14 +6,11 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.CouponService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
@@ -77,7 +74,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
|
||||
CouponEntity couponEntity = couponDao.selectById(couponId);
|
||||
if (couponEntity.getCurrentState()==0){
|
||||
int historyCount = couponHistoryDao.selectCount(new LambdaQueryWrapper<CouponHistory>()
|
||||
.eq(CouponHistory::getCouponId,couponId));
|
||||
.eq(CouponHistory::getCouponId,couponId)).intValue();
|
||||
//是否超出总发行量
|
||||
if (historyCount<couponEntity.getTotalCirculation()){
|
||||
List<CouponHistory> historyList = couponHistoryDao.selectList(new LambdaQueryWrapper<CouponHistory>()
|
||||
|
||||
@@ -4,19 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.dao.CourseGuestbookDao;
|
||||
import com.peanut.modules.common.dao.CourseGuestbookSupportDao;
|
||||
import com.peanut.modules.common.dao.MyUserDao;
|
||||
import com.peanut.modules.common.entity.CourseGuestbook;
|
||||
import com.peanut.modules.common.entity.CourseGuestbookSupport;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.common.service.CourseGuestbookService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -92,14 +89,14 @@ public class CourseGuestbookServiceImpl extends ServiceImpl<CourseGuestbookDao,
|
||||
public int getUserSupportCount(int guestbookId) {
|
||||
LambdaQueryWrapper<CourseGuestbookSupport> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseGuestbookSupport::getGuestbookId,guestbookId);
|
||||
return supportDao.selectCount(wrapper);
|
||||
return supportDao.selectCount(wrapper).intValue();
|
||||
}
|
||||
|
||||
public boolean getUserSupport(int guestbookId,int userId) {
|
||||
LambdaQueryWrapper<CourseGuestbookSupport> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseGuestbookSupport::getGuestbookId,guestbookId);
|
||||
wrapper.eq(CourseGuestbookSupport::getUserId,userId);
|
||||
int c = supportDao.selectCount(wrapper);
|
||||
int c = supportDao.selectCount(wrapper).intValue();
|
||||
if (c>0){
|
||||
return true;
|
||||
}else {
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.peanut.modules.common.to.ParamTo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -86,7 +85,7 @@ public class CoursePsycheServiceImpl extends ServiceImpl<CoursePsycheDao, Course
|
||||
@Override
|
||||
public R delCoursePsyche(int id) {
|
||||
//查看下一级是否存在
|
||||
int count = this.count(new LambdaQueryWrapper<CoursePsyche>().eq(CoursePsyche::getPid, id));
|
||||
Long count = this.count(new LambdaQueryWrapper<CoursePsyche>().eq(CoursePsyche::getPid, id));
|
||||
if(count>0){
|
||||
return R.error(501,"删除失败,请先删除子项目后再尝试");
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.teautil.Common;
|
||||
import com.aliyun.teautil.models.RuntimeOptions;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.SmsUtil;
|
||||
import com.peanut.modules.app.config.SMSConfig;
|
||||
import com.peanut.modules.app.config.Sample;
|
||||
import com.peanut.modules.common.dao.MyUserDao;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.common.service.MyUserService;
|
||||
@@ -22,15 +14,12 @@ import org.springframework.stereotype.Service;
|
||||
@Service("commonMyUserService")
|
||||
public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> implements MyUserService {
|
||||
|
||||
@Autowired
|
||||
private SMSConfig smsConfig;
|
||||
@Autowired
|
||||
private SmsUtil smsUtil;
|
||||
|
||||
@Override
|
||||
public R sendCodeForRegister(String phone, String code, Integer areaCode){
|
||||
String scode = code.split("_")[0];
|
||||
// sendCode(phone,scode,areaCode);
|
||||
if (areaCode!=null&&areaCode>0&&areaCode!=86){
|
||||
return smsUtil.sendSmsAbroad(""+areaCode+phone,scode);
|
||||
}else {
|
||||
@@ -38,36 +27,4 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
}
|
||||
}
|
||||
|
||||
private void sendCode(String phone, String code, Integer areaCode) throws Exception {
|
||||
com.aliyun.dysmsapi20170525.Client client = Sample.createClient(smsConfig.getAccessKeyId(),smsConfig.getAccessKeySecret());
|
||||
String tem;
|
||||
if(areaCode!=null&&areaCode>0&&areaCode!=86){
|
||||
tem = smsConfig.getSTemplateCode();
|
||||
phone = areaCode+phone;
|
||||
}else{
|
||||
tem = smsConfig.getTemplateCode();
|
||||
}
|
||||
SendSmsRequest sendSmsRequest = new SendSmsRequest()
|
||||
.setSignName(smsConfig.getSingName())
|
||||
.setTemplateCode(tem)
|
||||
.setPhoneNumbers(phone)
|
||||
.setTemplateParam("{\"code\":\""+ code +"\"}");
|
||||
RuntimeOptions runtime = new RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
|
||||
SendSmsResponseBody body = sendSmsResponse.getBody();
|
||||
// System.out.println(body.getMessage());
|
||||
} catch (TeaException error) {
|
||||
// 如有需要,请打印 error
|
||||
Common.assertAsString(error.message);
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 如有需要,请打印 error
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TrainingClassServiceImpl extends ServiceImpl<TrainingClassDao, Trai
|
||||
if (StringUtils.isNotEmpty(trainingClass.getVipType())){
|
||||
String[] vipTypes = trainingClass.getVipType().split(",");
|
||||
for (String vipType : vipTypes) {
|
||||
int count = userVipService.count(new LambdaQueryWrapper<UserVip>()
|
||||
Long count = userVipService.count(new LambdaQueryWrapper<UserVip>()
|
||||
.eq(UserVip::getUserId,userId).eq(UserVip::getType,vipType).eq(UserVip::getState,0));
|
||||
if (count>0){
|
||||
fee = trainingClass.getVipFee();
|
||||
@@ -113,7 +113,7 @@ public class TrainingClassServiceImpl extends ServiceImpl<TrainingClassDao, Trai
|
||||
|
||||
@Override
|
||||
public void addTrainingClassForUser(BuyOrder buyOrder) {
|
||||
int count = trainingToUserService.count(new LambdaQueryWrapper<TrainingToUser>()
|
||||
Long count = trainingToUserService.count(new LambdaQueryWrapper<TrainingToUser>()
|
||||
.eq(TrainingToUser::getUserId,buyOrder.getUserId())
|
||||
.eq(TrainingToUser::getTrainingId,buyOrder.getTrainingClassId()));
|
||||
if (count == 0){
|
||||
|
||||
@@ -57,7 +57,7 @@ public class UserInviteRegisterServiceImpl extends ServiceImpl<UserInviteRegiste
|
||||
inviteCode.append(chars.charAt(index));
|
||||
}
|
||||
int count = myUserDao.selectCount(new LambdaQueryWrapper<MyUserEntity>()
|
||||
.eq(MyUserEntity::getInviteCode,inviteCode.toString()));
|
||||
.eq(MyUserEntity::getInviteCode,inviteCode.toString())).intValue();
|
||||
if (count > 0) {
|
||||
code = generateInviteCode();
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user