|
@@ -13,14 +13,18 @@ import com.google.zxing.BarcodeFormat;
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import com.zhongzheng.common.annotation.DataScope;
|
|
|
+import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
+import com.zhongzheng.common.utils.file.FileUtils;
|
|
|
import com.zhongzheng.modules.alioss.service.OssService;
|
|
|
+import com.zhongzheng.modules.alioss.vo.FileBean;
|
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
|
+import com.zhongzheng.modules.base.bo.UserProfileFit;
|
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.course.domain.Major;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
@@ -66,6 +70,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.thymeleaf.util.StringUtils;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.xml.bind.DatatypeConverter;
|
|
|
import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
@@ -76,6 +81,7 @@ import java.util.*;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
/**
|
|
|
* 用户预约考试Service业务层处理
|
|
@@ -138,6 +144,8 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
private IWxLoginService iWxLoginService;
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Autowired
|
|
|
private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
|
|
|
|
|
@@ -236,7 +244,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
ExamApplyQueryBo applyQueryBo = new ExamApplyQueryBo();
|
|
|
applyQueryBo.setUserId(bo.getUserId());
|
|
|
- applyQueryBo.setGoodsId(bo.getGoodsId());
|
|
|
+ applyQueryBo.setOrderGoodsId(add.getOrderGoodsId());
|
|
|
//查询剩余考试次数
|
|
|
Integer residueSubscribeNext = examApplyMapper.residueSubscribeNext(applyQueryBo);
|
|
|
if (residueSubscribeNext == null || residueSubscribeNext < 1){
|
|
@@ -260,7 +268,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
add.setExamStatus(0);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- add.setExamineeCode(ServletUtils.getEncoded("ZZ"+ ToolsUtils.autoGenericCode(String.valueOf(add.getApplyId()),3) +ToolsUtils.autoGenericCode(String.valueOf(add.getUserId()),3)));
|
|
|
+ add.setExamineeCode(ServletUtils.getEncoded("ZZ"+ ToolsUtils.autoGenericCode(String.valueOf(add.getApplyId()),4) +ToolsUtils.autoGenericCode(String.valueOf(add.getUserId()),4)));
|
|
|
this.save(add);
|
|
|
//发送预约考试消息
|
|
|
sendExamSucceed(bo);
|
|
@@ -849,7 +857,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
//查询剩余考试次数
|
|
|
ExamApplyQueryBo examApplyQueryBo = new ExamApplyQueryBo();
|
|
|
examApplyQueryBo.setUserId(userId);
|
|
|
- examApplyQueryBo.setGoodsId(goodsId);
|
|
|
+ examApplyQueryBo.setOrderGoodsId(classGradeVo.getOrderGoodsId());
|
|
|
Integer residueSubscribeNext = examApplyMapper.residueSubscribeNext(examApplyQueryBo);
|
|
|
if (residueSubscribeNext == null || residueSubscribeNext < 1){
|
|
|
userSubscribeImport.setCause("剩余考试次数不足");
|
|
@@ -1079,7 +1087,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
//查询剩余考试次数
|
|
|
ExamApplyQueryBo examApplyQueryBo = new ExamApplyQueryBo();
|
|
|
examApplyQueryBo.setUserId(userId);
|
|
|
- examApplyQueryBo.setGoodsId(goodsId);
|
|
|
+ examApplyQueryBo.setOrderGoodsId(classGradeVo.getOrderGoodsId());
|
|
|
Integer residueSubscribeNext = examApplyMapper.residueSubscribeNext(examApplyQueryBo);
|
|
|
if (residueSubscribeNext == null || residueSubscribeNext < 1){
|
|
|
userSubscribeImport.setCause("剩余考试次数不足");
|
|
@@ -1742,7 +1750,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean signReport(MultipartFile image, UserSubscribeSignReportBo bo) {
|
|
|
+ public Boolean signReport(UserSubscribeSignReportBo bo) {
|
|
|
//获取考试预约信息
|
|
|
UserSubscribe userSubscribe = getById(bo.getSubscribeId());
|
|
|
if (ObjectUtils.isNull(userSubscribe)){
|
|
@@ -1755,7 +1763,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
String applyDate = DateUtils.timestampToDateFormat(Long.valueOf(userSubscribe.getApplySiteExamTime()), "yyyy-MM-dd");
|
|
|
bo.setApplySiteStartTime(String.format("%s %s",applyDate,userSubscribe.getApplySiteStartTime()));
|
|
|
//获取承诺书模板
|
|
|
- String reportUrl = drawReport(image, bo);
|
|
|
+ String reportUrl = drawReport(bo.getSignImageStr(),bo);
|
|
|
userSubscribe.setReportStatus(1);//已签署
|
|
|
userSubscribe.setReportFile(reportUrl);
|
|
|
updateById(userSubscribe);
|
|
@@ -1763,7 +1771,96 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long saveByAddBo(UserSubscribeAddBo bo, MultipartFile image) throws ParseException{
|
|
|
+ public List<UserSubscribeVo> signTimeSend() {
|
|
|
+ return baseMapper.signTimeSend();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String,Object> listUserExport(UserSubscribeQueryBo bo) {
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ List<UserVo> list = baseMapper.listUserExport(bo);
|
|
|
+ List<UserSubscribeStudentExportVo> list1 = new ArrayList<>();
|
|
|
+ List<FileBean> fileBeanList = new ArrayList<>(); //身份证列表
|
|
|
+ List<FileBean> fileBeanList2 = new ArrayList<>(); //证件照列表
|
|
|
+ String filename = FileUtils.encodingZipFilename("学员信息数据");
|
|
|
+ String zipFile = FileUtils.getZipAbsoluteFile(filename);
|
|
|
+ /* String filename2 = FileUtils.encodingZipFilename("证件照压缩包");
|
|
|
+ String zipFile2 = FileUtils.getZipAbsoluteFile(filename2);*/
|
|
|
+ try {
|
|
|
+ ZipOutputStream outStream = new ZipOutputStream(new FileOutputStream(zipFile));
|
|
|
+ // ZipOutputStream outStream2 = new ZipOutputStream(new FileOutputStream(zipFile2));
|
|
|
+ for (UserVo vo : list) {
|
|
|
+ UserSubscribeStudentExportVo item = BeanUtil.toBean(vo, UserSubscribeStudentExportVo.class);
|
|
|
+ if (Validator.isNotEmpty(vo.getSex())) {
|
|
|
+ if (vo.getSex() == 1) {
|
|
|
+ item.setSex("男");
|
|
|
+ }
|
|
|
+ if (vo.getSex() == 2) {
|
|
|
+ item.setSex("女");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list1.add(item);
|
|
|
+
|
|
|
+ if(Validator.isNotEmpty(vo.getIdCardImg1())){
|
|
|
+ FileBean f1 = new FileBean();
|
|
|
+ String idCardImg1 = vo.getIdCardImg1();
|
|
|
+ f1.setPath(idCardImg1);
|
|
|
+ f1.setFileName("身份证/"+vo.getIdCard() + "_0.jpg");
|
|
|
+ FileBean f2 = new FileBean();
|
|
|
+ String idCardImg2 = vo.getIdCardImg2();
|
|
|
+ f2.setPath(idCardImg2);
|
|
|
+ f2.setFileName("身份证/"+vo.getIdCard() + "_1.jpg");
|
|
|
+ fileBeanList.add(f1);
|
|
|
+ fileBeanList.add(f2);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(Validator.isNotEmpty(vo.getOneInchPhotos())){
|
|
|
+ FileBean f3 = new FileBean();
|
|
|
+ String oneInchPhotos = vo.getOneInchPhotos();
|
|
|
+ f3.setPath(oneInchPhotos);
|
|
|
+ f3.setFileName("证件照/"+vo.getIdCard() + ".jpg");
|
|
|
+ fileBeanList.add(f3);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Validator.isNotEmpty(vo.getKeyValue())){
|
|
|
+ Map<String, String> maps = JSONObject.parseObject(vo.getKeyValue(), Map.class);
|
|
|
+ String commitment_seal = JSONObject.parseObject(String.valueOf(maps.get("commitment_seal")), UserProfileFit.class).getValue();
|
|
|
+ FileBean f4 = new FileBean();
|
|
|
+ f4.setPath(commitment_seal);
|
|
|
+ f4.setFileName("承诺书/"+vo.getIdCard() + ".jpg");
|
|
|
+ fileBeanList.add(f4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ossService.zipWisdomDownload(fileBeanList,outStream);
|
|
|
+ // ossService.zipWisdomDownload(fileBeanList2,outStream2);
|
|
|
+ outStream.close();
|
|
|
+ // outStream2.close();
|
|
|
+ }
|
|
|
+ catch (IOException e) {
|
|
|
+ }
|
|
|
+ map.put("list", list1);
|
|
|
+ map.put("zip", AjaxResult.success(filename));
|
|
|
+ // map.put("zip2", AjaxResult.success(filename2));
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<UserSubscribeSignExportVo> listSignExport(UserSubscribeQueryBo bo) {
|
|
|
+ List<UserSubscribeVo> list = baseMapper.listSignExport(bo);
|
|
|
+ List<UserSubscribeSignExportVo> list1 = new ArrayList<>();
|
|
|
+ for(UserSubscribeVo vo : list){
|
|
|
+ UserSubscribeSignExportVo item = BeanUtil.toBean(vo, UserSubscribeSignExportVo.class);
|
|
|
+ if(Validator.isNotEmpty(vo.getWisdomReportTime())){
|
|
|
+ item.setWisdomReportTime(DateUtils.timestampToDateFormat(vo.getWisdomReportTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ }
|
|
|
+ list1.add(item);
|
|
|
+ }
|
|
|
+ return list1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long saveByAddBo(UserSubscribeAddBo bo) throws ParseException{
|
|
|
UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
|
if(Validator.isEmpty(add.getOrderGoodsId())){
|
|
|
throw new CustomException("缺失订单商品ID");
|
|
@@ -1813,13 +1910,14 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
reportBo.setUserId(bo.getUserId());
|
|
|
reportBo.setPhone(user.getTelphone());
|
|
|
reportBo.setIdCard(user.getIdCard());
|
|
|
- this.signReport(image,reportBo);
|
|
|
+ reportBo.setSignImageStr(bo.getSignImageStr());
|
|
|
+ this.signReport(reportBo);
|
|
|
//发送预约考试消息
|
|
|
sendExamSucceed(bo);
|
|
|
return add.getSubscribeId();
|
|
|
}
|
|
|
|
|
|
- private String drawReport(MultipartFile image, UserSubscribeSignReportBo bo){
|
|
|
+ private String drawReport(String imageStr, UserSubscribeSignReportBo bo){
|
|
|
Font font = new Font("宋体", Font.BOLD, 48);// 添加字体的属性设置 微软雅黑
|
|
|
String imgName = null;
|
|
|
try {
|
|
@@ -1841,7 +1939,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
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);
|
|
|
Image scaledInstance = qrImage.getScaledInstance(304, 251, Image.SCALE_AREA_AVERAGING);
|
|
|
//
|