|
@@ -3,20 +3,21 @@ package com.zhongzheng.modules.grade.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
+import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseEducationTypeQueryBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
|
|
|
import com.zhongzheng.modules.course.service.ICourseBusinessService;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseEducationTierService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseProjectTypeService;
|
|
|
import com.zhongzheng.modules.course.vo.*;
|
|
@@ -28,20 +29,16 @@ import com.zhongzheng.modules.grade.domain.ClassGradeSys;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeSysService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeStudentVo;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeUserListVo;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeUserVo;
|
|
|
+import com.zhongzheng.modules.grade.vo.*;
|
|
|
import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderMapper;
|
|
|
-import com.zhongzheng.modules.system.domain.SysConfig;
|
|
|
import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserUpdateQueryBo;
|
|
|
-import com.zhongzheng.modules.user.domain.SchoolProject;
|
|
|
-import com.zhongzheng.modules.user.domain.UserUpdate;
|
|
|
+import com.zhongzheng.modules.user.domain.*;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
import com.zhongzheng.modules.user.service.IUserUpdateService;
|
|
@@ -56,11 +53,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGrade;
|
|
|
import com.zhongzheng.modules.grade.mapper.ClassGradeMapper;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.HttpCookie;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -363,6 +360,20 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
|
|
|
@Override
|
|
|
public List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
|
|
|
+ //身份证去重
|
|
|
+ if (Validator.isNotEmpty(bo.getIdCard()) && Validator.isNotEmpty(bo.getIdCards())) {
|
|
|
+ String idCard = bo.getIdCard();
|
|
|
+ List<String> idCards = bo.getIdCards();
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
+ for (String id : idCards) {
|
|
|
+ set.add(id);
|
|
|
+ }
|
|
|
+ set.add(idCard);
|
|
|
+ if (Validator.isNotEmpty(set)) {
|
|
|
+ bo.setIdCards(new ArrayList<>(set));
|
|
|
+ }
|
|
|
+ bo.setIdCard(null);
|
|
|
+ }
|
|
|
//查找班级学员
|
|
|
List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGrade(bo);
|
|
|
//得到每个学员的课程学习记录
|
|
@@ -481,6 +492,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
public List<ClassGradeVo> getConsoleGradeList(ConsoleQueryBo bo) {
|
|
|
return baseMapper.getConsoleGradeList(bo);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<ClassGradeVo> selectByBusinessId(Long businessId) {
|
|
|
return baseMapper.selectByBusinessId(businessId);
|
|
@@ -506,6 +518,137 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return baseMapper.getConsoleGradeUserPeriodNum(bo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean OpenQdyAccount(OpenQdyAccountBo bo) {
|
|
|
+ int falseCount = 0;
|
|
|
+ // post 请求 传递json参数
|
|
|
+ String postLoginRequestUrl = "https://zjzyk.etledu.com/Account/GetLoginInfo";
|
|
|
+ // 参数
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("userCode", "gdxiangyue");
|
|
|
+ jsonObject.put("passWord", bo.getPassword());
|
|
|
+ jsonObject.put("typeId", "2");
|
|
|
+ jsonObject.put("yzm", bo.getYzm());
|
|
|
+ jsonObject.put("phoneNum", "15602322262");
|
|
|
+
|
|
|
+ // 设置请求头
|
|
|
+ Map<String, String> loginHead = new HashMap<>();
|
|
|
+ loginHead.put("Content-Type", "application/json;charset=UTF-8");
|
|
|
+ // 纯请求 要结果的话 最后加 .body()
|
|
|
+ HttpResponse loginHttpResponse = HttpRequest.post(postLoginRequestUrl) // url
|
|
|
+ .headerMap(loginHead, false) // 请求头设置
|
|
|
+ .body(jsonObject.toString()) // json参数
|
|
|
+ .timeout(5 * 60 * 1000) // 超时
|
|
|
+ .execute();
|
|
|
+
|
|
|
+ if (loginHttpResponse.body().contains("{\"\"success\"\":true")) {
|
|
|
+ HttpCookie cookie = loginHttpResponse.getCookie("jqb_cookies");
|
|
|
+ List<StudyAccountStatusQueryBo> studyAccountStatusList = bo.getStudyAccountStatusQueryBos();
|
|
|
+ if (Validator.isNotEmpty(studyAccountStatusList)) {
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ for (StudyAccountStatusQueryBo studyAccountStatusQueryBo : studyAccountStatusList) {
|
|
|
+ //查询学员url
|
|
|
+ String getInfoRequestUrl = "https://zjzyk.etledu.com/Student/GetCertInfos";
|
|
|
+ JSONObject getJsonObject = new JSONObject();
|
|
|
+ getJsonObject.put("personalId", studyAccountStatusQueryBo.getIdCard());
|
|
|
+ // 设置请求头
|
|
|
+ Map<String, String> getInfoHead = new HashMap<>();
|
|
|
+ getInfoHead.put("Content-Type", "application/json;charset=UTF-8");
|
|
|
+ getInfoHead.put("Cookie", cookie.toString());
|
|
|
+ // 纯请求 要结果的话 最后加 .body()
|
|
|
+ HttpResponse getInfoHttpResponse = HttpRequest.post(getInfoRequestUrl) // url
|
|
|
+ .headerMap(getInfoHead, false) // 请求头设置
|
|
|
+ .body(getJsonObject.toString()) // json参数
|
|
|
+ .timeout(5 * 60 * 1000) // 超时
|
|
|
+ .execute();
|
|
|
+ if (getInfoHttpResponse.body().contains("{\"\"success\"\":true")) {
|
|
|
+ PersonRoot personRoot = com.alibaba.fastjson.JSONObject.parseObject(getInfoHttpResponse.toString(), PersonRoot.class);
|
|
|
+ CertInfoListItem certInfoListItem = personRoot.getCertInfoList().get(0);
|
|
|
+ TrainInfosItem trainInfosItem = certInfoListItem.getTrainInfos().get(0);
|
|
|
+ cookie = getInfoHttpResponse.getCookie("jqb_cookies");
|
|
|
+ //查询继教产品url
|
|
|
+ String getProductUrl = "https://zjzyk.etledu.com/Student/GetProducts";
|
|
|
+ JSONObject getProductObject = new JSONObject();
|
|
|
+ getProductObject.put("workTypeCode", certInfoListItem.getWorkTypeCode());
|
|
|
+ getProductObject.put("period", "0");
|
|
|
+ getProductObject.put("trainYear", bo.getTrainYear());
|
|
|
+ // 设置请求头
|
|
|
+ Map<String, String> getProductHead = new HashMap<>();
|
|
|
+ getProductHead.put("Content-Type", "application/json;charset=UTF-8");
|
|
|
+ getProductHead.put("Cookie", cookie.toString());
|
|
|
+ // 纯请求 要结果的话 最后加 .body()
|
|
|
+ HttpResponse getProductHttpResponse = HttpRequest.post(getProductUrl) // url
|
|
|
+ .headerMap(getProductHead, false) // 请求头设置
|
|
|
+ .body(getJsonObject.toString()) // json参数
|
|
|
+ .timeout(5 * 60 * 1000) // 超时
|
|
|
+ .execute();
|
|
|
+ if (getProductHttpResponse.body().contains("{\"\"success\"\":true")) {
|
|
|
+ ProductRoot productRoot = com.alibaba.fastjson.JSONObject.parseObject(getProductHttpResponse.toString(), ProductRoot.class);
|
|
|
+ if (Validator.isEmpty(productRoot)) {
|
|
|
+ throw new CustomException("未获取到相关继教商品信息");
|
|
|
+ }
|
|
|
+ ProductsItem productsItem = productRoot.getProducts().get(0);
|
|
|
+ cookie = getProductHttpResponse.getCookie("jqb_cookies");
|
|
|
+ //学员开通url
|
|
|
+ String postOpenRequestUrl = "https://zjzyk.etledu.com/Student/SubmitProject";
|
|
|
+ JSONObject sumitJsonObject = new JSONObject();
|
|
|
+ sumitJsonObject.put("CertNumber", studyAccountStatusQueryBo.getIdCard());
|
|
|
+ sumitJsonObject.put("CertState", certInfoListItem.getCertState());
|
|
|
+ sumitJsonObject.put("CertTime", certInfoListItem.getCertTime());
|
|
|
+ sumitJsonObject.put("Name", studyAccountStatusQueryBo.getRealname());
|
|
|
+ sumitJsonObject.put("phoneNum", studyAccountStatusQueryBo.getTelphone());
|
|
|
+ sumitJsonObject.put("PersonalId", certInfoListItem.getPersonalId());
|
|
|
+ sumitJsonObject.put("ProvinceCode", certInfoListItem.getProvinceCode());
|
|
|
+ sumitJsonObject.put("ProvinceName", certInfoListItem.getProvinceName());
|
|
|
+ sumitJsonObject.put("WorkTypeCode", certInfoListItem.getWorkTypeCode());
|
|
|
+ sumitJsonObject.put("WorkTypeName", certInfoListItem.getWorkTypeName());
|
|
|
+ sumitJsonObject.put("productId", productsItem.getId());
|
|
|
+ sumitJsonObject.put("trainPeriodDate", trainInfosItem.getTrainPeriodTime());
|
|
|
+ sumitJsonObject.put("period", 0);
|
|
|
+ sumitJsonObject.put("IsBuyBook", 1);
|
|
|
+ sumitJsonObject.put("GetMethod", 1);
|
|
|
+ // 设置请求头
|
|
|
+ Map<String, String> sumitHead = new HashMap<>();
|
|
|
+ sumitHead.put("Content-Type", "application/json;charset=UTF-8");
|
|
|
+ sumitHead.put("Cookie", cookie.toString());
|
|
|
+ // 纯请求 要结果的话 最后加 .body()
|
|
|
+ HttpResponse sumitHttpResponse = HttpRequest.post(postOpenRequestUrl) // url
|
|
|
+ .headerMap(sumitHead, false) // 请求头设置
|
|
|
+ .body(sumitJsonObject.toString()) // json参数
|
|
|
+ .timeout(5 * 60 * 1000) // 超时
|
|
|
+ .execute();
|
|
|
+ //.body(); // 请求
|
|
|
+ com.alibaba.fastjson.JSONObject.parseObject(sumitHttpResponse.toString(), ClassGradeUserQueryBo.class);
|
|
|
+ //开通成功同步修改本地库learnStatus状态
|
|
|
+ if (sumitHttpResponse.body().contains("{\"\"success\"\":true")) {
|
|
|
+ ids.add(studyAccountStatusQueryBo.getId());
|
|
|
+ } else {
|
|
|
+ falseCount++;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException("获取相关继教商品信息失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException("根据身份证未获取相关数据失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Long[] id = new Long[]{};
|
|
|
+ id = ids.toArray(id);
|
|
|
+ ClassGradeUserEditBo classGradeUserEditBo = new ClassGradeUserEditBo();
|
|
|
+ classGradeUserEditBo.setId(id);
|
|
|
+ classGradeUserEditBo.setLearnStatus(1);
|
|
|
+ iClassGradeUserService.updateByEditBo(classGradeUserEditBo);
|
|
|
+ } else {
|
|
|
+ throw new UserPasswordNotMatchException();
|
|
|
+ }
|
|
|
+ if (falseCount > 0) {
|
|
|
+ throw new CustomException(falseCount + "个开通失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 实体类转化成视图对象
|
|
|
*
|