结班后证书发放
This commit is contained in:
@@ -27,6 +27,8 @@ public interface ClassEntityService extends IService<ClassEntity> {
|
||||
|
||||
R updateClassState(Map<String,Object> params);
|
||||
|
||||
String getNextCertificateNo(String type,String courseNamePinyin);
|
||||
|
||||
boolean editClass(Map<String ,Object> params);
|
||||
|
||||
R setUserRole(Map<String ,Object> params);
|
||||
@@ -95,6 +97,6 @@ public interface ClassEntityService extends IService<ClassEntity> {
|
||||
|
||||
List userScoreList(Map<String,Object> params);
|
||||
|
||||
List<Map<String,Object>> classCourseInfoClassId(int classId);
|
||||
List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface ClassExamService extends IService<ClassExam> {
|
||||
|
||||
void submitOption(Map<String,Object> params);
|
||||
|
||||
Object submitExamPaper(Map<String,Object> params);
|
||||
ClassExamUser submitExamPaper(Map<String,Object> params);
|
||||
|
||||
Object getExamPaperList(Map<String,Object> params);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ 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.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
@@ -54,6 +55,8 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
@Autowired
|
||||
private UserCertificateDao userCertificateDao;
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public Page getClassModelList(Map<String, Object> params) {
|
||||
@@ -334,6 +337,51 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
//获取下一个编号
|
||||
@Override
|
||||
public String getNextCertificateNo(String type,String courseNamePinyin){
|
||||
//抢锁
|
||||
Boolean lock = redisTemplate.opsForValue().setIfAbsent("certificateNoLock", "getNextCertificateNo");
|
||||
if(lock) {
|
||||
try {
|
||||
List<UserCertificate> userCertificateList = userCertificateDao.selectList(new LambdaQueryWrapper<UserCertificate>()
|
||||
.orderByDesc(UserCertificate::getId));
|
||||
String res = "";
|
||||
if (userCertificateList.size() > 0){
|
||||
UserCertificate u0 = userCertificateList.get(0);
|
||||
String certificateNo = u0.getCertificateNo();
|
||||
int no = 0;
|
||||
if (certificateNo.contains("ZK")){
|
||||
no = Integer.parseInt(certificateNo.substring(5,11))+1;
|
||||
}else {
|
||||
no = Integer.parseInt(certificateNo.substring(3,9))+1;
|
||||
}
|
||||
if ("A".equals(type)){
|
||||
res = "NO."+String.format("%06d", no);
|
||||
}else if ("B".equals(type)){
|
||||
res = "NO."+String.format("%06d", no);
|
||||
}else if ("ZK".equals(type)){
|
||||
res = "NO.ZK"+String.format("%06d", no);
|
||||
}
|
||||
}else {
|
||||
if ("A".equals(type)){
|
||||
res = "NO.000001";
|
||||
}else if ("B".equals(type)){
|
||||
res = "NO.000001";
|
||||
}else if ("ZK".equals(type)){
|
||||
res = "NO.ZK000001";
|
||||
}
|
||||
}
|
||||
return res+courseNamePinyin;
|
||||
}finally {
|
||||
//解锁
|
||||
redisTemplate.delete("certificateNoLock");
|
||||
}
|
||||
}else {
|
||||
return getNextCertificateNo(type,courseNamePinyin);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editClass(Map<String, Object> params) {
|
||||
ClassEntity c = new ClassEntity();
|
||||
@@ -1302,7 +1350,7 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,Object>> classCourseInfoClassId(int classId) {
|
||||
public List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId) {
|
||||
List<Map<String,Object>> res = new ArrayList<>();
|
||||
ClassEntity classEntity = this.baseMapper.selectById(classId);
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
@@ -1310,6 +1358,9 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
||||
wrapper.leftJoin(ClassCourse.class,ClassCourse::getCourseId,CourseEntity::getId);
|
||||
wrapper.leftJoin(ClassModel.class,ClassModel::getId,ClassCourse::getModelId);
|
||||
wrapper.eq(ClassModel::getId,classEntity.getModelId());
|
||||
if (courseId!=0){
|
||||
wrapper.eq(CourseEntity::getId,courseId);
|
||||
}
|
||||
List<CourseEntity> courseEntityList = courseDao.selectList(wrapper);
|
||||
for (CourseEntity course:courseEntityList){
|
||||
Map<String,Object> candk = new HashMap<>();
|
||||
|
||||
@@ -278,7 +278,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object submitExamPaper(Map<String, Object> params) {
|
||||
public ClassExamUser submitExamPaper(Map<String, Object> params) {
|
||||
ClassExamUser classExamUser = classExamUserDao.selectById(params.get("id").toString());
|
||||
List<Object> subjectList = JSONUtil.parseArray(classExamUser.getSubject());
|
||||
List<Object> answerList = JSONUtil.parseArray(classExamUser.getAnswer());
|
||||
|
||||
Reference in New Issue
Block a user