|
@@ -1753,7 +1753,6 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
bo.setMajor(major.getCategoryName());
|
|
|
String applyDate = DateUtils.timestampToDateFormat(Long.valueOf(userSubscribe.getApplySiteExamTime()), "yyyy-MM-dd");
|
|
|
bo.setApplySiteStartTime(String.format("%s %s",applyDate,userSubscribe.getApplySiteStartTime()));
|
|
|
- bo.setSeatNumber(userSubscribe.getSeatNumber());
|
|
|
//获取承诺书模板
|
|
|
String reportUrl = drawReport(image, bo);
|
|
|
userSubscribe.setReportStatus(1);//已签署
|
|
@@ -1762,6 +1761,63 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Long saveByAddBo(UserSubscribeAddBo bo, MultipartFile image) throws ParseException{
|
|
|
+ UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
|
+ if(Validator.isEmpty(add.getOrderGoodsId())){
|
|
|
+ throw new CustomException("缺失订单商品ID");
|
|
|
+ }
|
|
|
+ //判断当前时间是否超过了选择时间
|
|
|
+ Date date = new Date();
|
|
|
+ Long times = add.getApplySiteExamTime()*1000;//时间戳
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String dateString = formatter.format(times);
|
|
|
+ String dateForma =null;
|
|
|
+ dateForma = dateString+" "+add.getApplySiteStartTime().replace("-", ":");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Long time = sdf.parse(dateForma).getTime() / 1000;
|
|
|
+ if (System.currentTimeMillis()/1000 > time){
|
|
|
+ throw new CustomException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
|
|
|
+ }
|
|
|
+ //要求非必填考点
|
|
|
+ if(Validator.isNotEmpty(bo.getApplySiteAddress())){
|
|
|
+ ExamApplyQueryBo queryTimeBo = new ExamApplyQueryBo();
|
|
|
+ queryTimeBo.setApplyId(bo.getApplyId());
|
|
|
+ queryTimeBo.setStartTime(bo.getApplySiteStartTime().replace("-", ":"));
|
|
|
+ queryTimeBo.setEndTime(bo.getApplySiteEndTime().replace("-", ":"));
|
|
|
+ queryTimeBo.setExamTime(bo.getApplySiteExamTime());
|
|
|
+ queryTimeBo.setApplySiteAddress(bo.getApplySiteAddress());
|
|
|
+ //考点已申报人数
|
|
|
+ Long sitePeopleNum = examApplyMapper.sitePeopleNum(queryTimeBo);
|
|
|
+ String siteTimeJson = examApplyMapper.siteTimeJson(queryTimeBo);
|
|
|
+ if (Validator.isEmpty(siteTimeJson)) {
|
|
|
+ throw new CustomException("考点数据错误");
|
|
|
+ }
|
|
|
+ int num = findPeopleNum(queryTimeBo,siteTimeJson);
|
|
|
+ if(num==-1||num<=sitePeopleNum){
|
|
|
+ throw new CustomException("考点人数已满");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ add.setSubscribeStatus(1);
|
|
|
+ add.setExamStatus(0);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ add.setExamineeCode(ServletUtils.getEncoded("ZS"+add.getUserId()));
|
|
|
+ this.save(add);
|
|
|
+ //签署疫情防控书
|
|
|
+ UserSubscribeSignReportBo reportBo = new UserSubscribeSignReportBo();
|
|
|
+ reportBo.setSubscribeId(add.getSubscribeId());
|
|
|
+ User user = iUserService.getById(bo.getUserId());
|
|
|
+ reportBo.setUserId(bo.getUserId());
|
|
|
+ reportBo.setPhone(user.getTelphone());
|
|
|
+ reportBo.setIdCard(user.getIdCard());
|
|
|
+ this.signReport(image,reportBo);
|
|
|
+ //发送预约考试消息
|
|
|
+ sendExamSucceed(bo);
|
|
|
+ return add.getSubscribeId();
|
|
|
+ }
|
|
|
+
|
|
|
private String drawReport(MultipartFile image, UserSubscribeSignReportBo bo){
|
|
|
Font font = new Font("宋体", Font.BOLD, 48);// 添加字体的属性设置 微软雅黑
|
|
|
String imgName = null;
|
|
@@ -1779,10 +1835,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
|
|
|
g.drawString(bo.getApplySiteStartTime(), 668, 3341);
|
|
|
g.drawString(bo.getMajor(), 673, 3464);
|
|
|
- g.drawString(bo.getSeatNumber(), 615, 3603);
|
|
|
- g.drawString(bo.getIdCard(), 730, 3732);
|
|
|
- g.drawString(bo.getPhone(), 678, 3864);
|
|
|
- g.drawString(DateUtils.getDate(), 682, 3988);
|
|
|
+ g.drawString(bo.getIdCard(), 729, 3593);
|
|
|
+ g.drawString(bo.getPhone(), 681, 3725);
|
|
|
+ g.drawString(DateUtils.getDate(), 673, 3860);
|
|
|
|
|
|
//用户签名
|
|
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(image.getBytes());
|
|
@@ -1790,7 +1845,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
Image scaledInstance = qrImage.getScaledInstance(304, 251, Image.SCALE_AREA_AVERAGING);
|
|
|
//
|
|
|
// 在模板上添加用户签名图片(地址,左边距,上边距,图片宽度,图片高度,未知)
|
|
|
- g.drawImage(scaledInstance, 636, 4169, 304, 251, null);
|
|
|
+ g.drawImage(scaledInstance, 636, 4046, 304, 251, null);
|
|
|
// 完成模板修改
|
|
|
g.dispose();
|
|
|
//上传OSS
|