|
@@ -70,6 +70,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import org.thymeleaf.util.StringUtils;
|
|
import org.thymeleaf.util.StringUtils;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
|
|
+import javax.xml.bind.DatatypeConverter;
|
|
import java.awt.*;
|
|
import java.awt.*;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
@@ -1749,7 +1750,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Boolean signReport(MultipartFile image, UserSubscribeSignReportBo bo) {
|
|
|
|
|
|
+ public Boolean signReport(UserSubscribeSignReportBo bo) {
|
|
//获取考试预约信息
|
|
//获取考试预约信息
|
|
UserSubscribe userSubscribe = getById(bo.getSubscribeId());
|
|
UserSubscribe userSubscribe = getById(bo.getSubscribeId());
|
|
if (ObjectUtils.isNull(userSubscribe)){
|
|
if (ObjectUtils.isNull(userSubscribe)){
|
|
@@ -1762,7 +1763,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
String applyDate = DateUtils.timestampToDateFormat(Long.valueOf(userSubscribe.getApplySiteExamTime()), "yyyy-MM-dd");
|
|
String applyDate = DateUtils.timestampToDateFormat(Long.valueOf(userSubscribe.getApplySiteExamTime()), "yyyy-MM-dd");
|
|
bo.setApplySiteStartTime(String.format("%s %s",applyDate,userSubscribe.getApplySiteStartTime()));
|
|
bo.setApplySiteStartTime(String.format("%s %s",applyDate,userSubscribe.getApplySiteStartTime()));
|
|
//获取承诺书模板
|
|
//获取承诺书模板
|
|
- String reportUrl = drawReport(image, bo);
|
|
|
|
|
|
+ String reportUrl = drawReport(bo.getSignImageStr(),bo);
|
|
userSubscribe.setReportStatus(1);//已签署
|
|
userSubscribe.setReportStatus(1);//已签署
|
|
userSubscribe.setReportFile(reportUrl);
|
|
userSubscribe.setReportFile(reportUrl);
|
|
updateById(userSubscribe);
|
|
updateById(userSubscribe);
|
|
@@ -1859,7 +1860,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Long saveByAddBo(UserSubscribeAddBo bo, MultipartFile image) throws ParseException{
|
|
|
|
|
|
+ public Long saveByAddBo(UserSubscribeAddBo bo) throws ParseException{
|
|
UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
if(Validator.isEmpty(add.getOrderGoodsId())){
|
|
if(Validator.isEmpty(add.getOrderGoodsId())){
|
|
throw new CustomException("缺失订单商品ID");
|
|
throw new CustomException("缺失订单商品ID");
|
|
@@ -1909,13 +1910,14 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
reportBo.setUserId(bo.getUserId());
|
|
reportBo.setUserId(bo.getUserId());
|
|
reportBo.setPhone(user.getTelphone());
|
|
reportBo.setPhone(user.getTelphone());
|
|
reportBo.setIdCard(user.getIdCard());
|
|
reportBo.setIdCard(user.getIdCard());
|
|
- this.signReport(image,reportBo);
|
|
|
|
|
|
+ reportBo.setSignImageStr(bo.getSignImageStr());
|
|
|
|
+ this.signReport(reportBo);
|
|
//发送预约考试消息
|
|
//发送预约考试消息
|
|
sendExamSucceed(bo);
|
|
sendExamSucceed(bo);
|
|
return add.getSubscribeId();
|
|
return add.getSubscribeId();
|
|
}
|
|
}
|
|
|
|
|
|
- private String drawReport(MultipartFile image, UserSubscribeSignReportBo bo){
|
|
|
|
|
|
+ private String drawReport(String imageStr, UserSubscribeSignReportBo bo){
|
|
Font font = new Font("宋体", Font.BOLD, 48);// 添加字体的属性设置 微软雅黑
|
|
Font font = new Font("宋体", Font.BOLD, 48);// 添加字体的属性设置 微软雅黑
|
|
String imgName = null;
|
|
String imgName = null;
|
|
try {
|
|
try {
|
|
@@ -1937,7 +1939,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
g.drawString(DateUtils.getDate(), 673, 3860);
|
|
g.drawString(DateUtils.getDate(), 673, 3860);
|
|
|
|
|
|
//用户签名
|
|
//用户签名
|
|
- ByteArrayInputStream inputStream = new ByteArrayInputStream(image.getBytes());
|
|
|
|
|
|
+ String replace = imageStr.replace("data:image/jpeg;base64,", "");
|
|
|
|
+ byte[] imageBytes = DatatypeConverter.parseBase64Binary(replace);
|
|
|
|
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
|
|
BufferedImage qrImage = ImageIO.read(inputStream);
|
|
BufferedImage qrImage = ImageIO.read(inputStream);
|
|
Image scaledInstance = qrImage.getScaledInstance(304, 251, Image.SCALE_AREA_AVERAGING);
|
|
Image scaledInstance = qrImage.getScaledInstance(304, 251, Image.SCALE_AREA_AVERAGING);
|
|
//
|
|
//
|