|
|
@@ -194,21 +194,31 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
.eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
|
|
|
.eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
|
|
|
UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
+ if(Validator.isEmpty(userVo.getRealname())){
|
|
|
+ throw new CustomException("生成证书姓名缺失");
|
|
|
+ }
|
|
|
if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==1){
|
|
|
//获取章列表
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(bo);
|
|
|
BigDecimal totalTime = new BigDecimal(0);
|
|
|
+ BigDecimal totalClassHour = new BigDecimal(0);
|
|
|
BigDecimal publicTotalTime = new BigDecimal(0);
|
|
|
+ BigDecimal publicClassHour = new BigDecimal(0);
|
|
|
for(CourseChapterVo chapterVo : chapterList){
|
|
|
+ BigDecimal cTime = new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId()));
|
|
|
if(Validator.isEmpty(chapterVo.getCommonSign())||chapterVo.getCommonSign()==0){
|
|
|
- totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ totalTime=totalTime.add(cTime);
|
|
|
+ totalClassHour = totalClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}else if(chapterVo.getCommonSign()==1){
|
|
|
- publicTotalTime=publicTotalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ publicTotalTime=publicTotalTime.add(cTime);
|
|
|
+ publicClassHour = publicClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
- goodsVo.setPublicClassHours(publicTotalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setClassHours(totalClassHour);
|
|
|
+ goodsVo.setPublicClassHours(publicClassHour);
|
|
|
+ /* goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setPublicClassHours(publicTotalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));*/
|
|
|
if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
|
|
|
// String[] s = goodsVo.getCertificateIds().split(",");
|
|
|
List<Long> tpIds = new ArrayList<>();
|
|
|
@@ -242,10 +252,13 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
//获取章列表
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(bo);
|
|
|
BigDecimal totalTime = new BigDecimal(0);
|
|
|
+ BigDecimal totalClassHour = new BigDecimal(0);
|
|
|
for(CourseChapterVo chapterVo : chapterList){
|
|
|
- totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ BigDecimal cTime = new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId()));
|
|
|
+ totalTime=totalTime.add(cTime);
|
|
|
+ totalClassHour = totalClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}
|
|
|
- goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setClassHours(totalClassHour);
|
|
|
List<Long> tpIds = new ArrayList<>();
|
|
|
if(Validator.isNotEmpty(moduleVo.getCertificateTpId())){
|
|
|
tpIds.add(moduleVo.getCertificateTpId());
|
|
|
@@ -611,9 +624,17 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
addBo.setTrainStartTime(vo.getTrainStartTime());
|
|
|
addBo.setTrainEndTime(vo.getTrainEndTime());
|
|
|
addBo.setChapterStr(ArrayUtils.toString(vo.getChapterList(), ","));
|
|
|
+<<<<<<< HEAD
|
|
|
addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
|
|
|
addBo.setModuleId(moduleId);
|
|
|
addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
+=======
|
|
|
+ if(Validator.isEmpty(goodsVo.getPublicClassHours())){
|
|
|
+ addBo.setPublicClassHours(BigDecimal.ZERO);
|
|
|
+ }else{
|
|
|
+ addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
+ }
|
|
|
+>>>>>>> zs09
|
|
|
return addBo;
|
|
|
}
|
|
|
private String getCertificateCode(){
|
|
|
@@ -703,6 +724,9 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
else if(i==13){
|
|
|
numTag = "14. ";
|
|
|
}
|
|
|
+ else if(i==14){
|
|
|
+ numTag = "15. ";
|
|
|
+ }
|
|
|
chapterListTxt.add(numTag+chapterList.get(i).getName());
|
|
|
}
|
|
|
return chapterListTxt;
|
|
|
@@ -924,6 +948,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
private String drawPicErZao(CertificatePhotoVo entity){
|
|
|
Font font = new Font("微软雅黑", Font.PLAIN, 31);// 添加字体的属性设置 微软雅黑
|
|
|
Font font2 = new Font("微软雅黑", Font.BOLD, 38);
|
|
|
+ Font font3 = new Font("微软雅黑", Font.PLAIN, 28);
|
|
|
String imgName = null;
|
|
|
try {
|
|
|
// 加载本地图片
|
|
|
@@ -951,7 +976,13 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
if("必修".equals(entity.getMajor())){
|
|
|
g.drawString(entity.getMajor(), 768, 718);
|
|
|
}else{
|
|
|
+<<<<<<< HEAD
|
|
|
g.drawString("选修("+entity.getMajor()+")", 677, 718);
|
|
|
+=======
|
|
|
+ g.setFont(font3);
|
|
|
+ g.drawString("选修("+entity.getMajor()+")", 675, 718);
|
|
|
+ g.setFont(font);
|
|
|
+>>>>>>> zs09
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -965,7 +996,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
Integer startY = 810;
|
|
|
Integer j = 0;
|
|
|
for(String name : entity.getChapterList()){
|
|
|
- if(j<6){
|
|
|
+ if(j<15){
|
|
|
g.drawString(name, 300, startY);
|
|
|
startY+=50;
|
|
|
}else{
|
|
|
@@ -991,10 +1022,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
//二维码
|
|
|
String qrTxt = CERTIFICATE_HOST+"pages/certificate/index?code="+entity.getCode();
|
|
|
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
|
- BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
|
|
|
+ BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 180, 180);
|
|
|
BufferedImage qrImage = toBufferedImage(bitMatrix);
|
|
|
// 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
|
|
|
- g.drawImage(qrImage, 1233, 175, 150, 150, null);
|
|
|
+ g.drawImage(qrImage, 1209, 145, 180, 180, null);
|
|
|
// 完成模板修改
|
|
|
g.dispose();
|
|
|
// 获取新文件的地址
|
|
|
@@ -1019,6 +1050,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
private String drawPicErJian(CertificatePhotoVo entity){
|
|
|
Font font = new Font("微软雅黑", Font.PLAIN, 31);// 添加字体的属性设置 微软雅黑
|
|
|
Font font2 = new Font("微软雅黑", Font.BOLD, 38);
|
|
|
+ Font font3 = new Font("微软雅黑", Font.PLAIN, 28);
|
|
|
String imgName = null;
|
|
|
try {
|
|
|
// 加载本地图片
|
|
|
@@ -1046,7 +1078,14 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
if("必修".equals(entity.getMajor())){
|
|
|
g.drawString(entity.getMajor(), 768, 718);
|
|
|
}else{
|
|
|
+<<<<<<< HEAD
|
|
|
g.drawString("选修("+entity.getMajor()+")", 677, 718);
|
|
|
+=======
|
|
|
+ g.setFont(font3);
|
|
|
+ g.drawString("选修("+entity.getMajor()+")", 675, 718);
|
|
|
+ g.setFont(font);
|
|
|
+
|
|
|
+>>>>>>> zs09
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1060,7 +1099,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
Integer startY = 810;
|
|
|
Integer j = 0;
|
|
|
for(String name : entity.getChapterList()){
|
|
|
- if(j<14){
|
|
|
+ if(j<15){
|
|
|
g.drawString(name, 300, startY);
|
|
|
startY+=50;
|
|
|
}else{
|
|
|
@@ -1086,10 +1125,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
//二维码
|
|
|
String qrTxt = CERTIFICATE_HOST+"pages/certificate/index?code="+entity.getCode();
|
|
|
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
|
- BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
|
|
|
+ BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 180, 180);
|
|
|
BufferedImage qrImage = toBufferedImage(bitMatrix);
|
|
|
// 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
|
|
|
- g.drawImage(qrImage, 1233, 175, 150, 150, null);
|
|
|
+ g.drawImage(qrImage, 1209, 145, 180, 180, null);
|
|
|
// 完成模板修改
|
|
|
g.dispose();
|
|
|
// 获取新文件的地址
|