|
@@ -25,9 +25,14 @@ import com.zhongzheng.common.exception.BaseException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.type.EncryptHandler;
|
|
import com.zhongzheng.common.type.EncryptHandler;
|
|
import com.zhongzheng.common.utils.*;
|
|
import com.zhongzheng.common.utils.*;
|
|
|
|
+import com.zhongzheng.common.utils.file.FileUtils;
|
|
import com.zhongzheng.common.utils.http.HttpUtils;
|
|
import com.zhongzheng.common.utils.http.HttpUtils;
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
|
+import com.zhongzheng.modules.alioss.bo.OssRequest;
|
|
|
|
+import com.zhongzheng.modules.alioss.service.OssService;
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
|
+import com.zhongzheng.modules.base.domain.UserProfile;
|
|
|
|
+import com.zhongzheng.modules.base.service.IUserProfileService;
|
|
import com.zhongzheng.modules.collect.domain.CollectBank;
|
|
import com.zhongzheng.modules.collect.domain.CollectBank;
|
|
import com.zhongzheng.modules.collect.domain.CollectCourse;
|
|
import com.zhongzheng.modules.collect.domain.CollectCourse;
|
|
import com.zhongzheng.modules.collect.domain.CollectNote;
|
|
import com.zhongzheng.modules.collect.domain.CollectNote;
|
|
@@ -37,9 +42,12 @@ import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
|
|
import com.zhongzheng.modules.course.domain.Course;
|
|
import com.zhongzheng.modules.course.domain.Course;
|
|
import com.zhongzheng.modules.course.domain.CourseSection;
|
|
import com.zhongzheng.modules.course.domain.CourseSection;
|
|
import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
|
+import com.zhongzheng.modules.course.domain.Major;
|
|
import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
import com.zhongzheng.modules.course.service.ICourseService;
|
|
import com.zhongzheng.modules.course.service.ICourseService;
|
|
import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
|
|
+import com.zhongzheng.modules.course.service.IMajorService;
|
|
|
|
+import com.zhongzheng.modules.exam.service.IExamApplyService;
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
import com.zhongzheng.modules.goods.vo.UserNewGoodsVo;
|
|
import com.zhongzheng.modules.goods.vo.UserNewGoodsVo;
|
|
@@ -52,6 +60,7 @@ import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
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.UserCertificate;
|
|
import com.zhongzheng.modules.user.domain.UserStudyLog;
|
|
import com.zhongzheng.modules.user.domain.UserStudyLog;
|
|
import com.zhongzheng.modules.user.domain.UserVisitLog;
|
|
import com.zhongzheng.modules.user.domain.UserVisitLog;
|
|
import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
@@ -65,14 +74,20 @@ import org.springframework.beans.factory.annotation.Value;
|
|
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.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.nio.file.Files;
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
+import java.nio.file.Paths;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
-
|
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -121,16 +136,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ICourseSubjectService iCourseSubjectService;
|
|
private ICourseSubjectService iCourseSubjectService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserCertificateService iUserCertificateService;
|
|
@Autowired
|
|
@Autowired
|
|
private TokenService tokenService;
|
|
private TokenService tokenService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMajorService iMajorService;
|
|
@Autowired
|
|
@Autowired
|
|
private IUserVisitLogService iUserVisitLogService;
|
|
private IUserVisitLogService iUserVisitLogService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserProfileService iUserProfileService;
|
|
@Autowired
|
|
@Autowired
|
|
private IUserStudyLogService iUserStudyLogService;
|
|
private IUserStudyLogService iUserStudyLogService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IExamApplyService iExamApplyService;
|
|
@Autowired
|
|
@Autowired
|
|
private IUserLoginErrorService iUserLoginErrorService;
|
|
private IUserLoginErrorService iUserLoginErrorService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -139,7 +158,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
private IGoodsService iGoodsService;
|
|
private IGoodsService iGoodsService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISysTenantService iSysTenantService;
|
|
private ISysTenantService iSysTenantService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private OssService ossService;
|
|
@Autowired
|
|
@Autowired
|
|
private ICourseService iCourseService;
|
|
private ICourseService iCourseService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -1745,7 +1765,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
user.setSex(StringUtils.isNotBlank(item.getSex()) && item.getSex().equals("男") ? 1:2);
|
|
user.setSex(StringUtils.isNotBlank(item.getSex()) && item.getSex().equals("男") ? 1:2);
|
|
user.setEduLevel(item.getEducation());
|
|
user.setEduLevel(item.getEducation());
|
|
user.setSchool(item.getSchool());
|
|
user.setSchool(item.getSchool());
|
|
- user.setGraduationTime(item.getGraduationTime());
|
|
|
|
|
|
+ user.setGraduationTime(DateUtils.formatDate(item.getGraduationTime(),"yyyy-MM-dd"));
|
|
user.setMajor(item.getMajor());
|
|
user.setMajor(item.getMajor());
|
|
user.setWorkYear(item.getWorkYear());
|
|
user.setWorkYear(item.getWorkYear());
|
|
user.setCompanyName(item.getCompany());
|
|
user.setCompanyName(item.getCompany());
|
|
@@ -1756,6 +1776,113 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void userDataImgImport(MultipartFile file) {
|
|
|
|
+ String zhiyuan = System.getProperty("user.dir");
|
|
|
|
+ String path = zhiyuan+"/zhongzheng-admin/src/main/resources/xueyuanzhiliao";
|
|
|
|
+ try {
|
|
|
|
+ FileUtils.unzipWithStream(file.getInputStream(),path);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ throw new CustomException("文件解压错误");
|
|
|
|
+ }
|
|
|
|
+ // 路径
|
|
|
|
+ try (Stream<Path> paths = Files.walk(Paths.get(path))){
|
|
|
|
+ List<Path> fileNames = paths
|
|
|
|
+ .filter(Files::isRegularFile)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(fileNames)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ for (Path fileName : fileNames) {
|
|
|
|
+ Path name = fileName.getFileName();
|
|
|
|
+ //身份证号码
|
|
|
|
+ List<String> sign = Arrays.stream(name.toString().split("&")).collect(Collectors.toList());
|
|
|
|
+ //身份证号
|
|
|
|
+ String idCard = sign.get(0);
|
|
|
|
+ User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
|
+ .eq(User::getIdCard, EncryptHandler.encrypt(idCard)));
|
|
|
|
+ if (ObjectUtils.isNull(user)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //上传OSS
|
|
|
|
+ File userFile = new File(fileName.toString());
|
|
|
|
+ MultipartFile multipartFile = FileUtils.getMultipartFile(userFile);
|
|
|
|
+ OssRequest ossRequest = new OssRequest();
|
|
|
|
+ ossRequest.setUserId(user.getUserId());
|
|
|
|
+ ossRequest.setFile(multipartFile);
|
|
|
|
+ ossRequest.setImageStatus(0);
|
|
|
|
+ String upload = "";
|
|
|
|
+ try {
|
|
|
|
+ upload = ossService.upload(ossRequest);
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ throw new CustomException(name+"上传oss失败");
|
|
|
|
+ }
|
|
|
|
+ if (name.toString().contains("证件照")){
|
|
|
|
+ user.setAvatar(upload);
|
|
|
|
+ }
|
|
|
|
+ if (name.toString().contains("身份证正面")){
|
|
|
|
+ user.setIdCardImg1(upload);
|
|
|
|
+ }
|
|
|
|
+ if (name.toString().contains("身份证反面")){
|
|
|
|
+ user.setIdCardImg2(upload);
|
|
|
|
+ }
|
|
|
|
+ if (name.toString().contains("承诺书")){
|
|
|
|
+ //专业
|
|
|
|
+ String major = sign.get(sign.size() - 1);
|
|
|
|
+ List<UserProfile> userProfiles = iExamApplyService.getUserProfiles(idCard, "考前培训施工现场专业人员", major);
|
|
|
|
+ for (UserProfile userItem : userProfiles) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(userItem.getKeyValue());
|
|
|
|
+ Map<String, Object> userMap = new HashMap<>();
|
|
|
|
+ for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
|
|
|
|
+ userMap.put(entry.getKey(), entry.getValue());
|
|
|
|
+ }
|
|
|
|
+ String key = "commitment_electr_signature";
|
|
|
|
+ String fieldName = "承诺书电子签";
|
|
|
|
+ JSONObject recentJson = JSONObject.parseObject(userMap.get(key).toString());
|
|
|
|
+ Map<String, Object> recentMap = new HashMap<>();
|
|
|
|
+ for (Map.Entry<String, Object> entry : recentJson.entrySet()) {
|
|
|
|
+ recentMap.put(entry.getKey(), entry.getValue());
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isNotNull(recentMap)){
|
|
|
|
+ recentMap.put("value",upload);
|
|
|
|
+ }else {
|
|
|
|
+ recentMap.put("fieldKey",key);
|
|
|
|
+ recentMap.put("value",upload);
|
|
|
|
+ recentMap.put("fieldName",fieldName);
|
|
|
|
+ recentMap.put("status",0);
|
|
|
|
+ }
|
|
|
|
+ userMap.put(key,recentMap);
|
|
|
|
+ String content = JSONObject.toJSONString(userMap);
|
|
|
|
+ userItem.setKeyValue(content);
|
|
|
|
+ }
|
|
|
|
+ iUserProfileService.updateBatchById(userProfiles);
|
|
|
|
+ }
|
|
|
|
+ if (name.toString().contains("证书")){
|
|
|
|
+ //专业
|
|
|
|
+ String majorName = sign.get(sign.size() - 1);
|
|
|
|
+ Major major = iMajorService.getOne(new LambdaQueryWrapper<Major>()
|
|
|
|
+ .eq(Major::getCategoryName, majorName)
|
|
|
|
+ .eq(Major::getStatus, 1)
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+ if (ObjectUtil.isNotNull(major)){
|
|
|
|
+ iUserCertificateService.update(new LambdaUpdateWrapper<UserCertificate>()
|
|
|
|
+ .set(UserCertificate::getCertificatePath,upload)
|
|
|
|
+ .eq(UserCertificate::getUserId,user.getUserId())
|
|
|
|
+ .eq(UserCertificate::getMajorId,major.getId()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ updateById(user);
|
|
|
|
+ }
|
|
|
|
+ //删除本地文件
|
|
|
|
+ FileUtils.deleteFilePackage(path);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ throw new CustomException("学员资料有误");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {
|
|
public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {
|
|
if(Validator.isEmpty(bo.getAccount())){
|
|
if(Validator.isEmpty(bo.getAccount())){
|