|
@@ -24,6 +24,8 @@ import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
import com.zhongzheng.common.utils.file.FileUtils;
|
|
import com.zhongzheng.common.utils.file.FileUtils;
|
|
|
|
+import com.zhongzheng.common.utils.file.ImageUtils;
|
|
|
|
+import com.zhongzheng.modules.alioss.bo.OssRequest;
|
|
import com.zhongzheng.modules.alioss.service.OssService;
|
|
import com.zhongzheng.modules.alioss.service.OssService;
|
|
import com.zhongzheng.modules.alioss.vo.FileBean;
|
|
import com.zhongzheng.modules.alioss.vo.FileBean;
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
@@ -31,10 +33,7 @@ import com.zhongzheng.modules.base.bo.UserProfileFit;
|
|
import com.zhongzheng.modules.course.domain.Major;
|
|
import com.zhongzheng.modules.course.domain.Major;
|
|
import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
import com.zhongzheng.modules.course.service.IMajorService;
|
|
import com.zhongzheng.modules.course.service.IMajorService;
|
|
-import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
|
|
|
|
-import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeJson;
|
|
|
|
-import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeTwoAddBo;
|
|
|
|
-import com.zhongzheng.modules.exam.bo.ExamApplySubscribeBo;
|
|
|
|
|
|
+import com.zhongzheng.modules.exam.bo.*;
|
|
import com.zhongzheng.modules.exam.domain.ExamApply;
|
|
import com.zhongzheng.modules.exam.domain.ExamApply;
|
|
import com.zhongzheng.modules.exam.domain.ExamApplySite;
|
|
import com.zhongzheng.modules.exam.domain.ExamApplySite;
|
|
import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
|
|
import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
|
|
@@ -64,17 +63,21 @@ import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
import com.zhongzheng.modules.user.bo.*;
|
|
import com.zhongzheng.modules.user.bo.*;
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
import com.zhongzheng.modules.user.domain.UserExamGoods;
|
|
import com.zhongzheng.modules.user.domain.UserExamGoods;
|
|
|
|
+import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
|
|
import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
import com.zhongzheng.modules.user.mapper.UserSubscribeMapper;
|
|
import com.zhongzheng.modules.user.mapper.UserSubscribeMapper;
|
|
import com.zhongzheng.modules.user.service.IUserExamGoodsService;
|
|
import com.zhongzheng.modules.user.service.IUserExamGoodsService;
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
|
+import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
|
|
import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
import com.zhongzheng.modules.user.vo.*;
|
|
import com.zhongzheng.modules.user.vo.*;
|
|
import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.mock.web.MockMultipartFile;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
import org.thymeleaf.util.StringUtils;
|
|
import org.thymeleaf.util.StringUtils;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
@@ -151,6 +154,8 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
@Autowired
|
|
@Autowired
|
|
private IClassGradeUserService iClassGradeUserService;
|
|
private IClassGradeUserService iClassGradeUserService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserStudyRecordPhotoService iUserStudyRecordPhotoService;
|
|
|
|
|
|
@Value("${aliyun.sms.cancellationReminder}")
|
|
@Value("${aliyun.sms.cancellationReminder}")
|
|
private String cancellationReminder;
|
|
private String cancellationReminder;
|
|
@@ -2376,6 +2381,63 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
sendExamSucceed(userSubscribeAddBo);
|
|
sendExamSucceed(userSubscribeAddBo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 学员学时图片修改
|
|
|
|
+ * @author change
|
|
|
|
+ * @date 2023/7/18 14:29
|
|
|
|
+ * @param bo
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void updateStudentImage(UpdateStudentImageBo bo) {
|
|
|
|
+ //校验图片是否存在
|
|
|
|
+ List<UserStudyRecordPhoto> recordPhotos = iUserStudyRecordPhotoService.getListByPhoto(bo.getImageUrl());
|
|
|
|
+ if (CollectionUtils.isEmpty(recordPhotos)){
|
|
|
|
+ throw new CustomException("图片不存在,请检查图片!");
|
|
|
|
+ }
|
|
|
|
+ List<Long> userIds = recordPhotos.stream().map(UserStudyRecordPhoto::getUserId).collect(Collectors.toList());
|
|
|
|
+ List<User> users = iUserService.listByIdsNotTenant(userIds);
|
|
|
|
+ if (CollectionUtils.isEmpty(users)){
|
|
|
|
+ throw new CustomException("学员不存在,请检查!");
|
|
|
|
+ }
|
|
|
|
+ String encrypt = EncryptHandler.encrypt(bo.getIdCard());
|
|
|
|
+ if (users.stream().anyMatch(x -> !x.getIdCard().equals(encrypt))){
|
|
|
|
+ throw new CustomException("照片和学员不匹配,请检查!");
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ InputStream in = ossService.getStreamByObject(bo.getImageUrl());
|
|
|
|
+ BufferedImage img = ImageIO.read(in);
|
|
|
|
+ BufferedImage bufferedImage = ImageUtils.rotateImage(img, bo.getDegree());
|
|
|
|
+ OssRequest oss = new OssRequest();
|
|
|
|
+ oss.setImageStatus(0);
|
|
|
|
+ oss.setGradeId(0L);
|
|
|
|
+ oss.setUserId(0L);
|
|
|
|
+
|
|
|
|
+ //创建一个ByteArrayOutputStream
|
|
|
|
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
|
+ //把BufferedImage写入ByteArrayOutputStream
|
|
|
|
+ ImageIO.write(bufferedImage, "jpg", os);
|
|
|
|
+ //ByteArrayOutputStream转成InputStream
|
|
|
|
+ InputStream input = new ByteArrayInputStream(os.toByteArray());
|
|
|
|
+ //InputStream转成MultipartFile
|
|
|
|
+ MultipartFile multipartFile =new MockMultipartFile(DateUtils.getNowTime().toString(), DateUtils.getNowTime()+".jpg", "text/plain", input);
|
|
|
|
+
|
|
|
|
+// //将newImage写入字节数组输出流
|
|
|
|
+// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
|
+// ImageIO.write( bufferedImage, "jpg", baos);
|
|
|
|
+// //转换为MultipartFile
|
|
|
|
+// MultipartFile multipartFile = new MockMultipartFile(DateUtils.getNowTime().toString(), baos.toByteArray());
|
|
|
|
+
|
|
|
|
+ oss.setFile(multipartFile);
|
|
|
|
+ String upload = ossService.upload(oss);
|
|
|
|
+ List<Long> ids = recordPhotos.stream().map(UserStudyRecordPhoto::getId).collect(Collectors.toList());
|
|
|
|
+ iUserStudyRecordPhotoService.updateBatchByIdNotTenant(ids,upload);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ throw new CustomException("修改图片错误!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private Integer getSeatNumber(UserSubscribeAddBo bo,Long userNum) {
|
|
private Integer getSeatNumber(UserSubscribeAddBo bo,Long userNum) {
|
|
List<UserSubscribe> list = list(new LambdaQueryWrapper<UserSubscribe>().eq(UserSubscribe::getApplyId, bo.getApplyId())
|
|
List<UserSubscribe> list = list(new LambdaQueryWrapper<UserSubscribe>().eq(UserSubscribe::getApplyId, bo.getApplyId())
|