更改获取证书编号
This commit is contained in:
@@ -414,6 +414,7 @@ public class ClassController {
|
|||||||
type = "A";
|
type = "A";
|
||||||
}
|
}
|
||||||
userCertificate.setType(type);
|
userCertificate.setType(type);
|
||||||
|
userCertificate.setLabelId(5);
|
||||||
MyUserEntity user = (MyUserEntity)userScoreMap.get("user");
|
MyUserEntity user = (MyUserEntity)userScoreMap.get("user");
|
||||||
userCertificate.setUserId(user.getId());
|
userCertificate.setUserId(user.getId());
|
||||||
userCertificate.setClassId(classEntity.getId());
|
userCertificate.setClassId(classEntity.getId());
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ public class ClassExamController {
|
|||||||
if ("2".equals(classExamUser.getType())&&classExamUser.getScore()>=60){
|
if ("2".equals(classExamUser.getType())&&classExamUser.getScore()>=60){
|
||||||
UserCertificate userCertificate = new UserCertificate();
|
UserCertificate userCertificate = new UserCertificate();
|
||||||
userCertificate.setType("ZK");
|
userCertificate.setType("ZK");
|
||||||
|
userCertificate.setLabelId(8);
|
||||||
userCertificate.setUserId(ShiroUtils.getUId());
|
userCertificate.setUserId(ShiroUtils.getUId());
|
||||||
CourseEntity courseEntity = courseService.getById(classExamUser.getRelationId());
|
CourseEntity courseEntity = courseService.getById(classExamUser.getRelationId());
|
||||||
String courseTitle = courseEntity.getTitle();
|
String courseTitle = courseEntity.getTitle();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.peanut.modules.common.service.ClassEntityService;
|
|||||||
import com.peanut.modules.common.service.UserVipService;
|
import com.peanut.modules.common.service.UserVipService;
|
||||||
import com.peanut.modules.sys.dao.SysUserDao;
|
import com.peanut.modules.sys.dao.SysUserDao;
|
||||||
import com.peanut.modules.sys.entity.SysUserEntity;
|
import com.peanut.modules.sys.entity.SysUserEntity;
|
||||||
|
import com.peanut.modules.sys.service.SysDictDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.amqp.core.MessagePostProcessor;
|
import org.springframework.amqp.core.MessagePostProcessor;
|
||||||
@@ -65,6 +66,8 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
private StringRedisTemplate redisTemplate;
|
private StringRedisTemplate redisTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserVipService userVipService;
|
private UserVipService userVipService;
|
||||||
|
@Autowired
|
||||||
|
private SysDictDataService sysDictDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page getClassModelList(Map<String, Object> params) {
|
public Page getClassModelList(Map<String, Object> params) {
|
||||||
@@ -349,35 +352,21 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
Boolean lock = redisTemplate.opsForValue().setIfAbsent("certificateNoLock", "getNextCertificateNo");
|
Boolean lock = redisTemplate.opsForValue().setIfAbsent("certificateNoLock", "getNextCertificateNo");
|
||||||
if(lock) {
|
if(lock) {
|
||||||
try {
|
try {
|
||||||
List<UserCertificate> userCertificateList = userCertificateDao.selectList(new LambdaQueryWrapper<UserCertificate>()
|
com.peanut.modules.book.entity.SysDictDataEntity sysDictDataEntity =
|
||||||
.orderByDesc(UserCertificate::getCreateTime));
|
sysDictDataService.getOne(new LambdaQueryWrapper<com.peanut.modules.book.entity.SysDictDataEntity>()
|
||||||
String res = "";
|
.eq(com.peanut.modules.book.entity.SysDictDataEntity::getDictLabel,"userCertificateNo"));
|
||||||
if (userCertificateList.size() > 0){
|
int oldNo = Integer.parseInt(sysDictDataEntity.getDictValue());
|
||||||
UserCertificate u0 = userCertificateList.get(0);
|
sysDictDataEntity.setDictValue(oldNo+1+"");
|
||||||
String certificateNo = u0.getCertificateNo();
|
sysDictDataService.updateById(sysDictDataEntity);
|
||||||
int no = 0;
|
if ("A".equals(type)){
|
||||||
if (certificateNo.contains("ZK")){
|
return "NO."+String.format("%06d", oldNo)+courseNamePinyin+"-A";
|
||||||
no = Integer.parseInt(certificateNo.substring(5,11))+1;
|
}else if ("B".equals(type)){
|
||||||
}else {
|
return "NO."+String.format("%06d", oldNo)+courseNamePinyin+"-B";
|
||||||
no = Integer.parseInt(certificateNo.substring(3,9))+1;
|
}else if ("ZK".equals(type)){
|
||||||
}
|
return "NO.ZK"+String.format("%06d", oldNo)+courseNamePinyin;
|
||||||
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 {
|
}else {
|
||||||
if ("A".equals(type)){
|
return "NO."+String.format("%06d", oldNo)+courseNamePinyin;
|
||||||
res = "NO.000001";
|
|
||||||
}else if ("B".equals(type)){
|
|
||||||
res = "NO.000001";
|
|
||||||
}else if ("ZK".equals(type)){
|
|
||||||
res = "NO.ZK000001";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return res+courseNamePinyin;
|
|
||||||
}finally {
|
}finally {
|
||||||
//解锁
|
//解锁
|
||||||
redisTemplate.delete("certificateNoLock");
|
redisTemplate.delete("certificateNoLock");
|
||||||
|
|||||||
Reference in New Issue
Block a user