Commit 7fe0d011 authored by 刘帅's avatar 刘帅

1.bug修复

parent 40dfd19f
......@@ -475,6 +475,15 @@ public class ApiPCController {
return AjaxResult.success(evaluateAgencyMajorClass);
}
/**
* 查询专业分类列表-下拉框树列表
*/
@GetMapping("/getAllMajorClassList")
public AjaxResult getAllMajorClassList()
{
return AjaxResult.success(majorClassService.getAllMajorClassList());
}
/**
* 专业课程详情
*
......
......@@ -9,6 +9,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.weixin.config.WeiXinPayConfig;
import com.ruoyi.common.weixin.utils.WeiXinPayV3NewUtils;
import com.ruoyi.common.weixin.utils.WeiXinPayV3Utils;
import com.ruoyi.hezhi.api.entity.AliPayConfig;
import com.ruoyi.hezhi.api.entity.AlipayService;
......@@ -18,6 +19,7 @@ import com.ruoyi.hezhi.domain.dto.ExamPayInfoDto;
import com.ruoyi.hezhi.service.ITbExamRegistrationService;
import com.ruoyi.hezhi.service.ITbMemberOrderService;
import com.ruoyi.hezhi.service.IWxPayService;
import com.wechat.pay.java.service.payments.model.Transaction;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -56,6 +58,8 @@ public class ApiPayController {
private IWxPayService wxPayService;
@Resource
private ITbExamRegistrationService examRegistrationService;
@Resource
private WeiXinPayV3NewUtils weiXinPayV3NewUtils;
/**
* alipay扫码支付
......@@ -205,6 +209,8 @@ public class ApiPayController {
}
}
/***
* 获取微信支付H5
* @param orderNo 订单号
......@@ -212,7 +218,6 @@ public class ApiPayController {
*/
@GetMapping("/createH5PayParam")
public AjaxResult createH5PayParam(String orderNo) {
//todo 检测考试报名时间是否过了(微信)【待测试】
if (StrUtil.isBlank(orderNo)) {
throw new ServiceException("参数错误");
}
......@@ -234,46 +239,53 @@ public class ApiPayController {
memberOrderService.orderPayNotify(orderNo, 1);
return AjaxResult.success(data);
} else {
//单位为人民币(分)
JSONObject amount = new JSONObject();
amount.put("total", order.getPayPrice().multiply(new BigDecimal("100")).intValue());
amount.put("currency", "CNY");
// H5场景信息
JSONObject h5_info = new JSONObject();
amount.put("type", "Wap");// 场景类型,使用H5支付的场景:Wap、iOS、Android
// 场景信息
JSONObject scene_info = new JSONObject();
amount.put("payer_client_ip  ", IpUtils.getIpAddr());
amount.put("h5_info  ", h5_info);
JSONObject postData = new JSONObject();
postData.put("appid", weiXinPayConfig.getAppId());
postData.put("mchid", weiXinPayConfig.getMchId());
postData.put("description", order.getRemarks());
postData.put("out_trade_no", orderNo);
postData.put("notify_url", weiXinPayConfig.getH5NotifyUrl());
postData.put("amount", amount);
postData.put("scene_info", scene_info);
log.info("H5下单-参数 => {}", postData.toJSONString());
// 发送请求
JSONObject result = weiXinPayV3Utils.sendPost("https://api.mch.weixin.qq.com/v3/pay/transactions/h5", postData);
log.info("H5下单-结果 => {}", postData.toJSONString());
if (result.containsKey("h5_url")) {
// 支付二维码
Map<String, Object> map = new HashMap<>();
map.put("h5_url", result.getString("h5_url"));
map.put("isNeedPay", 1);
return AjaxResult.success(map);
String h5PayUrl = weiXinPayV3NewUtils.createH5PayParam(order.getPayPrice(), orderNo, order.getRemarks());
log.info("H5下单-结果 => {}", h5PayUrl);
if (null != h5PayUrl) {
return AjaxResult.success("操作成功", h5PayUrl);
} else {
log.error("H5下单调起失败 <{}> 参数:{},结果:{}", DateUtils.getTime(), postData.toJSONString(), result.toJSONString());
throw new ServiceException("H5下单调起失败");
}
}
}
@GetMapping("/createH5PayParamNotify")
private AjaxResult createH5PayParamNotify(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
String code = "FAIL";
String message = "";
try {
// 以支付通知回调为例,验签、解密并转换成 Transaction
Transaction transaction = weiXinPayV3NewUtils.getNotifyData(httpServletRequest);
if ("SUCCESS".equals(transaction.getTradeState().name())) {
log.error("订单回调 <{}> 订单参数 <{}> ", DateUtils.getTime(), transaction);
// 支付成功
String orderSn = transaction.getOutTradeNo();
String msg = "";
try {
TbMemberOrder tbMemberOrder = new TbMemberOrder();
tbMemberOrder.setOrderNo(orderSn);
tbMemberOrder.setPayStatus(1);
memberOrderService.updateTbMemberOrderByOrderNo(tbMemberOrder);
message = "回调成功";
} catch (Exception e) {
log.error("锅炉订单回调 <{}> 订单号 <{}> 订单处理异常", DateUtils.getTime(), orderSn);
msg = "FAIL";
}
if ("SUCCESS".equals(msg)) {
code = "SUCCESS";
} else {
message = "商户业务处理异常";
}
} else {
message = "回调参数异常";
}
} catch (Exception e) {
log.error("订单回调 <{}> 解析异常", DateUtils.getTime());
message = "回调参数解析异常";
}
return AjaxResult.success(message);
}
/**
* 微信支付回调
*
......
......@@ -7,8 +7,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.hezhi.domain.TbCourse;
import com.ruoyi.hezhi.domain.TbExam;
import com.ruoyi.hezhi.domain.TbTypeCourse;
import com.ruoyi.hezhi.domain.vo.CaseTypeVO;
import com.ruoyi.hezhi.mapper.TbExamMapper;
import com.ruoyi.hezhi.service.ITbCaseService;
import com.ruoyi.hezhi.service.ITbCaseTypeService;
import com.ruoyi.hezhi.service.ITbCourseService;
import com.ruoyi.hezhi.service.ITbTypeCourseService;
......@@ -17,7 +20,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -36,6 +41,8 @@ public class TbCourseController extends BaseController
private ITbTypeCourseService tbTypeCourseService;
@Autowired
private ITbCaseTypeService tbCaseTypeService;
@Autowired
private TbExamMapper tbExamMapper;
/**
* 查询课程列表
......@@ -140,7 +147,28 @@ public class TbCourseController extends BaseController
* @return
*/
@GetMapping("/getAllCourseList")
public AjaxResult getAllCourseList() {
return AjaxResult.success(tbCourseService.getAllCourseList());
public AjaxResult getAllCourseList(TbCourse tbCourse) {
List<TbCourse> courseList = tbCourseService.getAllCourseList();
if (courseList == null || courseList.isEmpty()) {
return AjaxResult.success(new ArrayList<>());
}
List<TbExam> tbExamList = tbExamMapper.selectTbExamListAll();
// 使用Set提高查找效率
Set<Long> careerIdSet = tbExamList.stream()
.map(TbExam::getCareerId)
.collect(Collectors.toSet());
// 如果tbCourse参数中的CareerId不为空,从careerIdSet中移除该值
if (tbCourse != null && tbCourse.getCareerId() != null) {
careerIdSet.remove(tbCourse.getCareerId());
}
// 过滤掉在careerIdSet中存在的课程
List<TbCourse> result = courseList.stream()
.filter(course -> !careerIdSet.contains(course.getCourseId()))
.collect(Collectors.toList());
return AjaxResult.success(result);
}
}
......@@ -154,6 +154,13 @@
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-java</artifactId>
<version>0.2.17</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
......
package com.ruoyi.common.weixin.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* 微信支付V3相关参数配置
*
* @author Wzp
*/
@Getter
@Setter
@Configuration
public class WeiXinH5PayConfig {
@Value("${wx.pay.h5.appId}")
private String appId;
@Value("${wx.pay.h5.mchId}")
private String mchId;
@Value("${wx.pay.h5.mchSerialNum}")
private String mchSerialNum;
@Value("${wx.pay.h5.apiV3Key}")
private String apiV3Key;
//微信回调地址
@Value("${wx.pay.h5.notifyUrl}")
private String notifyUrl;
//微信H5回调地址
@Value("${wx.pay.h5.h5NotifyUrl}")
private String h5NotifyUrl;
//支付宝回调地址
@Value("${wx.pay.h5.notifyZfbUrl}")
private String notifyZfbUrl;
@Value("${wx.pay.h5.description}")
private String description;
@Value("${wx.pay.h5.apiClientKey}")
private String apiClientKey;
@Value("${wx.login.appId}")
private String appIdLogin;
@Value("${wx.login.appSecret}")
private String appSecretLogin;
@Value("${wx.login.redirectUrl}")
private String redirectUrl;
}
......@@ -68,9 +68,9 @@ public class WeiXinPayV3Utils {
* @throws Exception 异常
*/
private void setVerifier() throws Exception {
if (merchantPrivateKey == null) {
// if (merchantPrivateKey == null) {
setMerchantPrivateKey();
}
// }
// 获取证书管理器实例
CertificatesManager certificatesManager = CertificatesManager.getInstance();
// 向证书管理器增加需要自动更新平台证书的商户信息
......
......@@ -47,6 +47,14 @@ public class TbExam extends BaseEntity
@Excel(name = "专业名")
private String majorName;
/** 机构ID */
@Excel(name = "机构ID")
private Long evaluateAgencyId;
/** 机构名称 */
@Excel(name = "机构名称")
private String evaluateAgencyName;
/** 职业ID */
@Excel(name = "职业ID")
private Long careerId;
......
......@@ -31,6 +31,13 @@ public interface TbExamMapper
*/
public List<TbExam> selectTbExamList(TbExam tbExam);
/**
* 查询考试列表
*
* @return 考试集合
*/
public List<TbExam> selectTbExamListAll();
/**
* 查询考试列表
*
......
......@@ -51,6 +51,8 @@ public class TbExamServiceImpl implements ITbExamService
private TbExamBatchMapper tbExamBatchMapper;
@Resource
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Resource
private TbEvaluateAgencyMapper tbEvaluateAgencyMapper;
/**
* 查询考试
......@@ -127,6 +129,22 @@ public class TbExamServiceImpl implements ITbExamService
tbExamCourseMapper.insertTbExamCourse(tbExamCourse);
}
}
if (null != tbExam.getEvaluateAgencyId()) {
TbEvaluateAgency evaluateAgency = tbEvaluateAgencyMapper.selectTbEvaluateAgencyByEvaluateAgencyId(tbExam.getEvaluateAgencyId());
tbExam.setEvaluateAgencyName(evaluateAgency.getEvaluateAgencyName());
}
if (null != tbExam.getCareerId()) {
TbCourse tbCourse = tbCourseMapper.selectTbCourseByCourseId(tbExam.getCareerId());
tbExam.setCareerName(tbCourse.getCourseName());
}
if (null != tbExam.getExamId()) {
TbCourse course = new TbCourse();
course.setCareerId(tbExam.getCareerId());
course.setExamId(tbExam.getExamId());
tbCourseMapper.updateTbCourse(course);
}
// 考试批次
List<TbExamBatch> tbExamBatchList = tbExam.getExamBatchList();
......@@ -244,6 +262,22 @@ public class TbExamServiceImpl implements ITbExamService
// tbExamBatchMapper.updateTbExamBatchBatch(toUpdate); // 你需要写批量 update 逻辑
// }
if (null != tbExam.getEvaluateAgencyId()) {
TbEvaluateAgency evaluateAgency = tbEvaluateAgencyMapper.selectTbEvaluateAgencyByEvaluateAgencyId(tbExam.getEvaluateAgencyId());
tbExam.setEvaluateAgencyName(evaluateAgency.getEvaluateAgencyName());
}
if (null != tbExam.getCareerId()) {
TbCourse tbCourse = tbCourseMapper.selectTbCourseByCourseId(tbExam.getCareerId());
tbExam.setCareerName(tbCourse.getCourseName());
}
if (null != tbExam.getExamId()) {
TbCourse course = new TbCourse();
course.setCourseId(tbExam.getCareerId());
course.setExamId(tbExam.getExamId());
tbCourseMapper.updateTbCourse(course);
}
// 考试批次
List<TbExamBatch> tbExamBatchList = tbExam.getExamBatchList();
if (!tbExamBatchList.isEmpty()){
......@@ -347,13 +381,16 @@ public class TbExamServiceImpl implements ITbExamService
if (ObjectUtils.isNotEmpty(tbExamCourse)){
Long examId = tbExamCourse.getExamId();
TbExam tbExam = tbExamMapper.selectTbExamByExamId(examId);
List<TbExamBatch> enableByExamId = tbExamBatchMapper.getEnableByExamId(examId, tbExam.getExamBatchEarly());
if (!enableByExamId.isEmpty()){
TbExamBatch tbExamBatch = enableByExamId.get(0);
courseListVO.setExamBatch(tbExamBatch.getExamBatch());
courseListVO.setExamId(tbExam.getExamId());
courseListVO.setLevel(getLevel(tbExam.getLevel()));//等级也查出来
if (tbExam != null) {
List<TbExamBatch> enableByExamId = tbExamBatchMapper.getEnableByExamId(examId, tbExam.getExamBatchEarly());
if (!enableByExamId.isEmpty()){
TbExamBatch tbExamBatch = enableByExamId.get(0);
courseListVO.setExamBatch(tbExamBatch.getExamBatch());
courseListVO.setExamId(tbExam.getExamId());
courseListVO.setLevel(getLevel(tbExam.getLevel()));//等级也查出来
}
}
}
countDownLatch.countDown();
});
......
......@@ -180,12 +180,12 @@ public class TbExamSubjectServiceImpl implements ITbExamSubjectService {
*/
@Override
public List<Map<String, Object>> queryByParam(Map<String, Object> params) {
Long courseId = MapUtils.getLong(params, "courseId");
TbExamCourse examCourseDetail = tbExamCourseMapper.getSubjectWarehouseClassIdByCourseId(courseId);
if (ObjectUtils.isEmpty(examCourseDetail)) {
throw new ServiceException("此课程未添加题库");
}
params.put("subjectWarehouseClassId", examCourseDetail.getSubjectWarehouseClassId());
// Long courseId = MapUtils.getLong(params, "courseId");
// TbExamCourse examCourseDetail = tbExamCourseMapper.getSubjectWarehouseClassIdByCourseId(courseId);
// if (ObjectUtils.isEmpty(examCourseDetail)) {
// throw new ServiceException("此课程未添加题库");
// }
// params.put("subjectWarehouseClassId", examCourseDetail.getSubjectWarehouseClassId());
return tbExamSubjectMapper.queryByParam(params);
}
......
......@@ -356,9 +356,9 @@ public class TbMemberExamSimulateAllServiceImpl implements ITbMemberExamSimulate
try {
endTimeCompare = dateFormat.parse(endTime);
// 比较时间
if (currentTime.after(endTimeCompare)) {
return AjaxResult.error("做题时间【" + tbExamSimulateInfo.getStartTime() + "至" + tbExamSimulateInfo.getEndTime() + "】,考试已结束");
}
// if (currentTime.after(endTimeCompare)) {
// return AjaxResult.error("做题时间【" + tbExamSimulateInfo.getStartTime() + "至" + tbExamSimulateInfo.getEndTime() + "】,考试已结束");
// }
if (currentTime.after(examEndTimeCompare)) {
return AjaxResult.error("考试时间【" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamStartTime()) + "至" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", tbExamBatch.getExamEndTime()) + "】,考试已结束");
}
......
......@@ -6,6 +6,7 @@ import com.ruoyi.hezhi.domain.TbMemberSubjectCollect;
import com.ruoyi.hezhi.domain.dto.MemberSubjectCollectDTO;
import com.ruoyi.hezhi.mapper.TbExamSubjectAnswerMapper;
import com.ruoyi.hezhi.mapper.TbMemberSubjectCollectMapper;
import com.ruoyi.hezhi.mapper.TbMemberSubjectWrongMapper;
import com.ruoyi.hezhi.service.ITbMemberSubjectCollectService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +29,8 @@ public class TbMemberSubjectCollectServiceImpl implements ITbMemberSubjectCollec
private TbMemberSubjectCollectMapper tbMemberSubjectCollectMapper;
@Autowired
private TbExamSubjectAnswerMapper examSubjectAnswerMapper;
@Autowired
private TbMemberSubjectWrongMapper memberSubjectWrongMapper;
/**
* 查询我的收藏题目
......@@ -146,6 +149,8 @@ public class TbMemberSubjectCollectServiceImpl implements ITbMemberSubjectCollec
// 选项列表
List<Map<String, Object>> subjectSelectList = examSubjectAnswerMapper.selectSelectList(null, examSubjectNo);
examSubjectInfo.put("subjectSelectList", subjectSelectList);
// 我的答案
// memberSubjectWrongMapper.selectTbMemberSubjectWrongByMemberSubjectWrongId();
// 处理answer字段
String answer = examSubjectInfo.get("answer").toString();
String[] answerOptions = answer.split(",");
......
......@@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="className" column="class_name" />
<result property="majorId" column="major_id" />
<result property="majorName" column="major_name" />
<result property="evaluateAgencyId" column="evaluate_agency_id" />
<result property="evaluateAgencyName" column="evaluate_agency_name" />
<result property="careerId" column="career_id" />
<result property="careerName" column="career_name" />
<result property="logo" column="logo" />
......@@ -60,11 +62,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTbExamVo">
select exam_id, exam_no, class_id, class_name, major_id, major_name, career_id, career_name, logo, file_url, name, title, content, introduce, single_select_num, single_select_score, many_select_num, many_select_score, judge_num, judge_score, discuss_num, discuss_score, total_score, pass_score, exam_minute, exam_batch_early, exam_batch, tips, exam_start_time, exam_end_time, sign_start_time, sign_end_time, price, exam_status, is_change, change_day, type, examine_status, examine_feedback, sort, remarks, status, publication_time, publisher, create_time, create_by, update_time, update_by, delete_time, delete_by, del_flag, level from tb_exam
select exam_id, exam_no, class_id, class_name, major_id, major_name, evaluate_agency_id, evaluate_agency_name, career_id, career_name, logo, file_url, name, title, content, introduce, single_select_num, single_select_score, many_select_num, many_select_score, judge_num, judge_score, discuss_num, discuss_score, total_score, pass_score, exam_minute, exam_batch_early, exam_batch, tips, exam_start_time, exam_end_time, sign_start_time, sign_end_time, price, exam_status, is_change, change_day, type, examine_status, examine_feedback, sort, remarks, status, publication_time, publisher, create_time, create_by, update_time, update_by, delete_time, delete_by, del_flag, level from tb_exam
</sql>
<select id="selectTbExamList" parameterType="TbExam" resultMap="TbExamResult">
select DISTINCT te.exam_id, te.exam_no, te.class_id, te.class_name, te.major_id, tmc.major_name major_name, te.career_id, tcc.career_name career_name,
select DISTINCT te.exam_id, te.exam_no, te.class_id, te.class_name, te.major_id, tmc.major_name major_name,te.evaluate_agency_id, te.evaluate_agency_name, te.career_id, tcc.career_name career_name,
te.logo, te.file_url, te.name, te.title, te.content, te.introduce,te.level,
te.single_select_num, te.single_select_score, te.many_select_num, te.many_select_score,
te.judge_num, te.judge_score, te.discuss_num, te.discuss_score, te.total_score, te.pass_score,
......@@ -139,6 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="className != null">class_name,</if>
<if test="majorId != null">major_id,</if>
<if test="majorName != null">major_name,</if>
<if test="evaluateAgencyId != null">evaluate_agency_id,</if>
<if test="evaluateAgencyName != null">evaluate_agency_name,</if>
<if test="careerId != null">career_id,</if>
<if test="careerName != null">career_name,</if>
<if test="logo != null and logo != ''">logo,</if>
......@@ -192,6 +196,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="className != null">#{className},</if>
<if test="majorId != null">#{majorId},</if>
<if test="majorName != null">#{majorName},</if>
<if test="evaluateAgencyId != null">#{evaluateAgencyId},</if>
<if test="evaluateAgencyName != null">#{evaluateAgencyName},</if>
<if test="careerId != null">#{careerId},</if>
<if test="careerName != null">#{careerName},</if>
<if test="logo != null and logo != ''">#{logo},</if>
......@@ -249,6 +255,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="className != null">class_name = #{className},</if>
<if test="majorId != null">major_id = #{majorId},</if>
<if test="majorName != null">major_name = #{majorName},</if>
<if test="evaluateAgencyId != null">evaluate_agency_id = #{evaluateAgencyId},</if>
<if test="evaluateAgencyName != null">evaluate_agency_name = #{evaluateAgencyName},</if>
<if test="careerId != null">career_id = #{careerId},</if>
<if test="careerName != null">career_name = #{careerName},</if>
<if test="logo != null and logo != ''">logo = #{logo},</if>
......@@ -529,4 +537,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTbExamVo"/>
where name = #{name}
</select>
<select id="selectTbExamListAll" resultMap="TbExamResult">
<include refid="selectTbExamVo"/>
</select>
</mapper>
......@@ -176,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getExamNoticeList" resultType="map">
SELECT
exam_id AS examId,
exam_notice_id AS examNoticeId,
CONVERT(IFNULL(exam_notice_logo, ''), CHAR) AS examNoticeLogo,
CONVERT(IFNULL(exam_notice_name, ''), CHAR) AS examNoticeName,
......
......@@ -190,7 +190,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
CONVERT(IFNULL(tc.tag_name, ''), CHAR) AS tagName,
tc.is_recommend AS isRecommend,
IFNULL(tmcTwo.major_id, 0) AS majorIdTwo,
CONVERT(IFNULL(tmcTwo.major_name, ''), CHAR) AS majorNameTwo
CONVERT(IFNULL(tmcTwo.major_name, ''), CHAR) AS majorNameTwo,
tc.exam_id AS examId
from tb_course tc
left join tb_major_class tmcTwo on tc.major_id = tmcTwo.major_id
left join tb_exam_course tec on tc.course_id = tec.course_id
......
......@@ -389,6 +389,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ sin( radians(#{latitude}) )
* sin( radians( latitude ) ) ) ) AS distance
FROM tb_study_center
WHERE examine_status = 1
ORDER BY distance
LIMIT 1;
</select>
......
......@@ -62,9 +62,10 @@ export function listLinkLiveBroadcastTeacher(query) {
}
// 所有课程列表
export function getAllCourseList() {
export function getAllCourseList(query) {
return request({
url: '/hezhi/course/getAllCourseList',
method: 'get',
params: query
})
}
......@@ -280,9 +280,30 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="机构">
<el-select v-model="form.evaluateAgencyId" placeholder="请选择机构" @change="handleAgencyChange()">
<el-option
v-for="(item, index) in evaluateAgencyOptions"
:key="index"
:label="item.evaluateAgencyName"
:value="item.evaluateAgencyId">
</el-option>
</el-select>
<!-- <exam-course :exam-course-list="form.examCourseList" />-->
</el-form-item>
<el-form-item label="职业名称">
<exam-course :exam-course-list="form.examCourseList" />
<el-select v-model="form.careerId" placeholder="请选择职业名称">
<el-option
v-for="(item, index) in getCourseOptions()"
:key="index"
:label="item.courseName"
:value="item.courseId">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="职业名称">-->
<!-- <exam-course :exam-course-list="form.examCourseList" />-->
<!-- </el-form-item>-->
<el-form-item label="报名提前天数" prop="examBatchEarly">
<el-input-number v-model="form.examBatchEarly" :step="1" step-strictly />
</el-form-item>
......@@ -474,6 +495,8 @@
import {addExam, delExam, getExam, listExam, updateExam, updateExamConfig} from "@/api/hezhi/exam";
import ExamCourse from "@/components/ExamCourse/index.vue";
import ExamBatch from "@/views/hezhi/exam/examBatch.vue";
import {getSelectList} from "@/api/hezhi/evaluateAgency";
import {getAllCourseList} from "@/api/hezhi/link";
export default {
name: "Exam",
......@@ -508,6 +531,8 @@ export default {
daterangeSignStartTime: [],
// 删除标记时间范围
daterangeSignEndTime: [],
evaluateAgencyOptions:[],
courseOptions:[],
// 查询参数
queryParams: {
pageNum: 1,
......@@ -600,11 +625,21 @@ export default {
getSelectList().then(response => {
this.evaluateAgencyOptions = response.data;
});
getAllCourseList().then(response => {
this.courseOptions = response.data;
});
},
methods: {
getAllCourse(careerId) {
getAllCourseList({careerId}).then(response => {
this.courseOptions = response.data;
})
},
// 重选机构清空对应课程
handleAgencyChange() {
this.form.careerId = undefined;
},
getCourseOptions() {
let evaluateAgencyId = this.form.evaluateAgencyId;
return this.courseOptions.filter(item => item.evaluateAgencyId === evaluateAgencyId);
},
/**
* 处理价格输入,限制最多两位小数
*/
......@@ -683,6 +718,8 @@ export default {
className: null,
majorId: null,
majorName: null,
evaluateAgencyId: null,
evaluateAgencyName: null,
careerId: null,
careerName: null,
logo: null,
......@@ -757,6 +794,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加考试";
this.getAllCourse()
},
/** 修改按钮操作 */
handleUpdate(row) {
......@@ -764,6 +802,7 @@ export default {
const examId = row.examId || this.ids
getExam(examId).then(response => {
this.form = response.data;
this.getAllCourse(this.form.careerId)
this.open = true;
this.title = "修改考试";
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment