给指定用户生成制定课程的证书
This commit is contained in:
@@ -494,12 +494,6 @@ public class ClassController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @RequestMapping("/createCertificateNo")
|
|
||||||
// public R createCertificateNo() {
|
|
||||||
// String certificateNo = classEntityService.getNextCertificateNo("B", "");
|
|
||||||
// log.info("========certificateNo========="+certificateNo);
|
|
||||||
// return R.ok(certificateNo);
|
|
||||||
// }
|
|
||||||
//结班
|
//结班
|
||||||
@RequestMapping("/closeClass")
|
@RequestMapping("/closeClass")
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -646,7 +640,4 @@ public class ClassController {
|
|||||||
List<UserCertificate> userCertificate = userCertificateService.list(wrapper);
|
List<UserCertificate> userCertificate = userCertificateService.list(wrapper);
|
||||||
return R.ok().put("userCertificate",userCertificate);
|
return R.ok().put("userCertificate",userCertificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public interface ClassEntityService extends IService<ClassEntity> {
|
|||||||
|
|
||||||
List userScoreList(Map<String,Object> params);
|
List userScoreList(Map<String,Object> params);
|
||||||
|
|
||||||
|
Map<String,Object> getClassCourseInfoByClassId(int classId, int courseId);
|
||||||
|
|
||||||
List<Map<String,Object>> classCourseInfoClassId(int classId, int courseId);
|
List<Map<String,Object>> classCourseInfoClassId(int classId, int courseId);
|
||||||
|
|
||||||
R closeClass(Map<String,Object> params);
|
R closeClass(Map<String,Object> params);
|
||||||
|
|||||||
@@ -1692,7 +1692,37 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
|
|||||||
}
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> getClassCourseInfoByClassId(int classId, int courseId) {
|
||||||
|
ClassEntity classEntity = this.baseMapper.selectById(classId);
|
||||||
|
|
||||||
|
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.selectAll(CourseEntity.class);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
CourseEntity course = courseDao.selectOne(wrapper);
|
||||||
|
|
||||||
|
Map<String,Object> candk = new HashMap<>();
|
||||||
|
MPJLambdaWrapper<CourseCatalogueChapterEntity> w = new MPJLambdaWrapper<>();
|
||||||
|
w.leftJoin(CourseCatalogueChapterVideoEntity.class,CourseCatalogueChapterVideoEntity::getChapterId,CourseCatalogueChapterEntity::getId);
|
||||||
|
w.eq(CourseCatalogueChapterEntity::getCourseId,course.getId());
|
||||||
|
w.selectSum(CourseCatalogueChapterVideoEntity::getDuration);
|
||||||
|
Map<String,Object> map = courseCatalogueChapterDao.selectJoinMap(w);
|
||||||
|
double duration = Double.parseDouble(map.get("duration").toString());
|
||||||
|
double minute = duration/60;
|
||||||
|
double keshi = Math.ceil(minute/45);
|
||||||
|
candk.put("courseId",course.getId());
|
||||||
|
candk.put("courseTitle",course.getTitle());
|
||||||
|
candk.put("courseETitle",course.getEtitle());
|
||||||
|
candk.put("titleAbbr",course.getTitleAbbr());
|
||||||
|
candk.put("keshi",keshi);
|
||||||
|
|
||||||
|
return candk;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId) {
|
public List<Map<String,Object>> classCourseInfoClassId(int classId,int courseId) {
|
||||||
List<Map<String,Object>> res = new ArrayList<>();
|
List<Map<String,Object>> res = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.peanut.modules.master.controller;
|
package com.peanut.modules.master.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
@@ -38,6 +39,10 @@ public class UserCertificateController {
|
|||||||
private CourseMedicalService courseMedicalService;
|
private CourseMedicalService courseMedicalService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CourseToMedicalService courseToMedicalService;
|
private CourseToMedicalService courseToMedicalService;
|
||||||
|
@Autowired
|
||||||
|
private MyUserService userService;
|
||||||
|
@Autowired
|
||||||
|
private ClassEntityService classEntityService;
|
||||||
|
|
||||||
//小班自考证书列表
|
//小班自考证书列表
|
||||||
@RequestMapping("/userClassAndZKCertificateList")
|
@RequestMapping("/userClassAndZKCertificateList")
|
||||||
@@ -278,6 +283,56 @@ public class UserCertificateController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("/createCertificateNo")
|
||||||
|
public R createCertificateNo(@RequestBody Map<String,Object> params){
|
||||||
|
ClassEntity classEntity = classEntityService.getById(params.get("classId").toString());
|
||||||
|
String type = params.get("type").toString();
|
||||||
|
List<String> certificateNoList = new ArrayList<>();
|
||||||
|
Map<String,Object> classCourseInfo = classEntityService.getClassCourseInfoByClassId(classEntity.getId(),0);
|
||||||
|
String pinyin = classCourseInfo.get("titleAbbr").toString();
|
||||||
|
|
||||||
|
String tels = params.get("tels").toString();
|
||||||
|
List<String> telList = Arrays.asList(tels.split(","));
|
||||||
|
List<MyUserEntity> userList = userService.list(new LambdaQueryWrapper<MyUserEntity>()
|
||||||
|
.in(MyUserEntity::getTel, telList));
|
||||||
|
|
||||||
|
for (int i=0;i<userList.size();i++){
|
||||||
|
MyUserEntity user = userList.get(i);
|
||||||
|
UserCertificate userCertificate = new UserCertificate();
|
||||||
|
userCertificate.setTitle(classEntity.getTitle());
|
||||||
|
userCertificate.setType(type);
|
||||||
|
userCertificate.setLabelId(5);
|
||||||
|
userCertificate.setUserId(user.getId());
|
||||||
|
userCertificate.setClassId(classEntity.getId());
|
||||||
|
|
||||||
|
String certificateNo = classEntityService.getNextCertificateNo(type,pinyin);
|
||||||
|
userCertificate.setCertificateNo(certificateNo);
|
||||||
|
userCertificate.setCourseId((Integer) classCourseInfo.get("courseId"));
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhoto())&&StringUtils.isNotEmpty(user.getName())){
|
||||||
|
String startYear = DateUtil.year(classEntity.getStartTime())+"";
|
||||||
|
String startMonth = DateUtil.month(classEntity.getStartTime())+1+"";
|
||||||
|
String startDay = DateUtil.dayOfMonth(classEntity.getStartTime())+"";
|
||||||
|
String endYear = DateUtil.year(classEntity.getEndTime())+"";
|
||||||
|
String endMonth = DateUtil.month(classEntity.getEndTime())+1+"";
|
||||||
|
String endDay = DateUtil.dayOfMonth(classEntity.getEndTime())+"";
|
||||||
|
double keshiTotal = (double)classCourseInfo.get("keshi");
|
||||||
|
String keshi = (keshiTotal+"").replace(".0","");
|
||||||
|
String courseTitle = classCourseInfo.get("courseTitle").toString();
|
||||||
|
if (courseTitle.contains("【")){
|
||||||
|
courseTitle = courseTitle.substring(0,courseTitle.indexOf("【"));
|
||||||
|
}
|
||||||
|
String[] des = {startYear,startMonth,startDay,endYear,endMonth,endDay,
|
||||||
|
classEntity.getTitle(),courseTitle,keshi};
|
||||||
|
String[] edes = {classCourseInfo.get("courseETitle").toString(),keshi};
|
||||||
|
String url = userCertificateService.generateCertificate(type,certificateNo,user.getPhoto(),user.getName(),
|
||||||
|
des, edes, endYear,endMonth,endDay);
|
||||||
|
userCertificate.setCertificateUrl(url);
|
||||||
|
}
|
||||||
|
userCertificateService.save(userCertificate);
|
||||||
|
certificateNoList.add(user.getTel());
|
||||||
|
}
|
||||||
|
return R.ok().put("certificateNoList",certificateNoList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user