|
@@ -30,6 +30,10 @@ import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
|
|
|
import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseModuleService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseChapterVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseModuleVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
import com.zhongzheng.modules.course.service.IMajorService;
|
|
|
import com.zhongzheng.modules.course.vo.*;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
@@ -99,14 +103,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseModuleService iCourseModuleService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IMajorService iMajorService;
|
|
|
-
|
|
|
@Value("${certificate.host}")
|
|
|
private String CERTIFICATE_HOST;
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public CertificateTpVo queryById(Long tpId){
|
|
|
CertificateTp db = this.baseMapper.selectById(tpId);
|
|
@@ -193,31 +194,21 @@ 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(cTime);
|
|
|
- totalClassHour = totalClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
+ totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
}else if(chapterVo.getCommonSign()==1){
|
|
|
- publicTotalTime=publicTotalTime.add(cTime);
|
|
|
- publicClassHour = publicClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
+ publicTotalTime=publicTotalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- 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));*/
|
|
|
+ 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<>();
|
|
@@ -251,13 +242,10 @@ 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){
|
|
|
- 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 ));
|
|
|
+ totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
}
|
|
|
- goodsVo.setClassHours(totalClassHour);
|
|
|
+ goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
List<Long> tpIds = new ArrayList<>();
|
|
|
if(Validator.isNotEmpty(moduleVo.getCertificateTpId())){
|
|
|
tpIds.add(moduleVo.getCertificateTpId());
|
|
@@ -625,11 +613,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
addBo.setChapterStr(ArrayUtils.toString(vo.getChapterList(), ","));
|
|
|
addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
|
|
|
addBo.setModuleId(moduleId);
|
|
|
- if(Validator.isEmpty(goodsVo.getPublicClassHours())){
|
|
|
- addBo.setPublicClassHours(BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
- }
|
|
|
+ addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
return addBo;
|
|
|
}
|
|
|
private String getCertificateCode(){
|
|
@@ -719,9 +703,6 @@ 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;
|
|
@@ -824,9 +805,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
g.drawString(entity.getRemark1(), 1035, 408);
|
|
|
g.drawString(entity.getRemark2(), 728, 460);
|
|
|
|
|
|
- /* g.drawString(entity.getDateY(), 707, 677);
|
|
|
- g.drawString(entity.getDateM(), 783, 677);
|
|
|
- g.drawString(entity.getDateD(), 835, 677);*/
|
|
|
+
|
|
|
|
|
|
g.drawString(entity.getDateY(), 945, 677);
|
|
|
g.drawString(entity.getDateM(), 1019, 677);
|
|
@@ -945,7 +924,6 @@ 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 {
|
|
|
// 加载本地图片
|
|
@@ -973,9 +951,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
if("必修".equals(entity.getMajor())){
|
|
|
g.drawString(entity.getMajor(), 768, 718);
|
|
|
}else{
|
|
|
- g.setFont(font3);
|
|
|
- g.drawString("选修("+entity.getMajor()+")", 670, 718);
|
|
|
- g.setFont(font);
|
|
|
+ g.drawString("选修("+entity.getMajor()+")", 677, 718);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -989,7 +965,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
Integer startY = 810;
|
|
|
Integer j = 0;
|
|
|
for(String name : entity.getChapterList()){
|
|
|
- if(j<15){
|
|
|
+ if(j<6){
|
|
|
g.drawString(name, 300, startY);
|
|
|
startY+=50;
|
|
|
}else{
|
|
@@ -1015,10 +991,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, 180, 180);
|
|
|
+ BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
|
|
|
BufferedImage qrImage = toBufferedImage(bitMatrix);
|
|
|
// 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
|
|
|
- g.drawImage(qrImage, 1209, 145, 180, 180, null);
|
|
|
+ g.drawImage(qrImage, 1233, 175, 150, 150, null);
|
|
|
// 完成模板修改
|
|
|
g.dispose();
|
|
|
// 获取新文件的地址
|
|
@@ -1043,7 +1019,6 @@ 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 {
|
|
|
// 加载本地图片
|
|
@@ -1071,10 +1046,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
if("必修".equals(entity.getMajor())){
|
|
|
g.drawString(entity.getMajor(), 768, 718);
|
|
|
}else{
|
|
|
- g.setFont(font3);
|
|
|
- g.drawString("选修("+entity.getMajor()+")", 670, 718);
|
|
|
- g.setFont(font);
|
|
|
-
|
|
|
+ g.drawString("选修("+entity.getMajor()+")", 677, 718);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1088,7 +1060,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
Integer startY = 810;
|
|
|
Integer j = 0;
|
|
|
for(String name : entity.getChapterList()){
|
|
|
- if(j<15){
|
|
|
+ if(j<14){
|
|
|
g.drawString(name, 300, startY);
|
|
|
startY+=50;
|
|
|
}else{
|
|
@@ -1114,10 +1086,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, 180, 180);
|
|
|
+ BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
|
|
|
BufferedImage qrImage = toBufferedImage(bitMatrix);
|
|
|
// 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
|
|
|
- g.drawImage(qrImage, 1209, 145, 180, 180, null);
|
|
|
+ g.drawImage(qrImage, 1233, 175, 150, 150, null);
|
|
|
// 完成模板修改
|
|
|
g.dispose();
|
|
|
// 获取新文件的地址
|