Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kaoshi-java
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
单欣鑫
kaoshi-java
Commits
7fe0d011
Commit
7fe0d011
authored
Aug 23, 2025
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.bug修复
parent
40dfd19f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
616 additions
and
62 deletions
+616
-62
ApiPCController.java
...main/java/com/ruoyi/hezhi/api/kaoshi/ApiPCController.java
+9
-0
ApiPayController.java
...ain/java/com/ruoyi/hezhi/api/kaoshi/ApiPayController.java
+47
-35
TbCourseController.java
...n/java/com/ruoyi/hezhi/controller/TbCourseController.java
+30
-2
pom.xml
ruoyi-common/pom.xml
+7
-0
WeiXinH5PayConfig.java
...ava/com/ruoyi/common/weixin/config/WeiXinH5PayConfig.java
+57
-0
WeiXinPayV3NewUtils.java
...va/com/ruoyi/common/weixin/utils/WeiXinPayV3NewUtils.java
+330
-0
WeiXinPayV3Utils.java
.../java/com/ruoyi/common/weixin/utils/WeiXinPayV3Utils.java
+2
-2
TbExam.java
...i-system/src/main/java/com/ruoyi/hezhi/domain/TbExam.java
+8
-0
TbExamMapper.java
...em/src/main/java/com/ruoyi/hezhi/mapper/TbExamMapper.java
+7
-0
TbExamServiceImpl.java
.../java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java
+43
-6
TbExamSubjectServiceImpl.java
...om/ruoyi/hezhi/service/impl/TbExamSubjectServiceImpl.java
+6
-6
TbMemberExamSimulateAllServiceImpl.java
...ezhi/service/impl/TbMemberExamSimulateAllServiceImpl.java
+3
-3
TbMemberSubjectCollectServiceImpl.java
...hezhi/service/impl/TbMemberSubjectCollectServiceImpl.java
+5
-0
TbExamMapper.xml
...i-system/src/main/resources/mapper/hezhi/TbExamMapper.xml
+13
-2
TbExamNoticeMapper.xml
...em/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml
+1
-0
TbMajorClassMapper.xml
...em/src/main/resources/mapper/hezhi/TbMajorClassMapper.xml
+2
-1
TbStudyCenterMapper.xml
...m/src/main/resources/mapper/hezhi/TbStudyCenterMapper.xml
+1
-0
link.js
ruoyi-ui/src/api/hezhi/link.js
+2
-1
index.vue
ruoyi-ui/src/views/hezhi/exam/index.vue
+43
-4
No files found.
ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiPCController.java
View file @
7fe0d011
...
...
@@ -475,6 +475,15 @@ public class ApiPCController {
return
AjaxResult
.
success
(
evaluateAgencyMajorClass
);
}
/**
* 查询专业分类列表-下拉框树列表
*/
@GetMapping
(
"/getAllMajorClassList"
)
public
AjaxResult
getAllMajorClassList
()
{
return
AjaxResult
.
success
(
majorClassService
.
getAllMajorClassList
());
}
/**
* 专业课程详情
*
...
...
ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiPayController.java
View file @
7fe0d011
...
...
@@ -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
);
}
/**
* 微信支付回调
*
...
...
ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbCourseController.java
View file @
7fe0d011
...
...
@@ -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
);
}
}
ruoyi-common/pom.xml
View file @
7fe0d011
...
...
@@ -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>
...
...
ruoyi-common/src/main/java/com/ruoyi/common/weixin/config/WeiXinH5PayConfig.java
0 → 100644
View file @
7fe0d011
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
;
}
ruoyi-common/src/main/java/com/ruoyi/common/weixin/utils/WeiXinPayV3NewUtils.java
0 → 100644
View file @
7fe0d011
package
com
.
ruoyi
.
common
.
weixin
.
utils
;
import
cn.hutool.core.net.URLEncodeUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.ip.IpUtils
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
com.ruoyi.common.weixin.config.WeiXinH5PayConfig
;
import
com.ruoyi.common.weixin.config.WeiXinPayConfig
;
import
com.wechat.pay.java.core.Config
;
import
com.wechat.pay.java.core.RSAAutoCertificateConfig
;
import
com.wechat.pay.java.core.cipher.SignatureResult
;
import
com.wechat.pay.java.core.cipher.Signer
;
import
com.wechat.pay.java.core.http.*
;
import
com.wechat.pay.java.core.notification.NotificationConfig
;
import
com.wechat.pay.java.core.notification.NotificationParser
;
import
com.wechat.pay.java.service.payments.h5.model.H5Info
;
import
com.wechat.pay.java.service.payments.h5.model.SceneInfo
;
import
com.wechat.pay.java.service.payments.jsapi.JsapiService
;
import
com.wechat.pay.java.service.payments.jsapi.model.Amount
;
import
com.wechat.pay.java.service.payments.jsapi.model.Payer
;
import
com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest
;
import
com.wechat.pay.java.service.payments.jsapi.model.PrepayResponse
;
import
com.wechat.pay.java.service.payments.h5.H5Service
;
import
com.wechat.pay.java.service.payments.model.Transaction
;
import
com.wechat.pay.java.service.refund.model.AmountReq
;
import
com.wechat.pay.java.service.refund.model.CreateRequest
;
import
com.wechat.pay.java.service.refund.model.Refund
;
import
com.wechat.pay.java.service.refund.model.Status
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.math.BigDecimal
;
/**
* 微信V3支付
*
* @author Wzp
*/
@Component
public
class
WeiXinPayV3NewUtils
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Resource
private
WeiXinH5PayConfig
weiXinH5PayConfig
;
/***
* 请求JSAPI下单
* @param total 金额
* @param openId 支付用户
* @param orderSn 订单号
* @param description 描述
* @param notifyApi 回调接口名称
* @return 结果
*/
public
JSONObject
createPayParam
(
BigDecimal
total
,
String
openId
,
String
orderSn
,
String
description
,
String
notifyApi
)
{
//更新证书配置,这里用官方sdk,不需要考虑时效性问题
Config
config
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
weiXinH5PayConfig
.
getMchId
())
.
privateKey
(
weiXinH5PayConfig
.
getApiClientKey
())
//微信v3-私钥
.
merchantSerialNumber
(
weiXinH5PayConfig
.
getMchSerialNum
())
//微信v3证书序列号
.
apiV3Key
(
weiXinH5PayConfig
.
getApiV3Key
())
//微信v3-apiV3Key
.
build
();
Amount
amount
=
new
Amount
();
amount
.
setTotal
(
total
.
multiply
(
new
BigDecimal
(
"100"
)).
intValue
());
amount
.
setCurrency
(
"CNY"
);
Payer
payer
=
new
Payer
();
payer
.
setOpenid
(
openId
);
PrepayRequest
prepayRequest
=
new
PrepayRequest
();
prepayRequest
.
setMchid
(
weiXinH5PayConfig
.
getMchId
());
prepayRequest
.
setOutTradeNo
(
orderSn
);
prepayRequest
.
setAppid
(
weiXinH5PayConfig
.
getAppId
());
prepayRequest
.
setDescription
(
description
);
prepayRequest
.
setNotifyUrl
(
weiXinH5PayConfig
.
getNotifyUrl
()
+
notifyApi
);
prepayRequest
.
setAmount
(
amount
);
prepayRequest
.
setPayer
(
payer
);
logger
.
info
(
"JSAPI下单-参数 => {}"
,
prepayRequest
.
toString
());
// 构建请求
JsapiService
jsapiService
=
new
JsapiService
.
Builder
().
config
(
config
).
build
();
PrepayResponse
prepay
=
jsapiService
.
prepay
(
prepayRequest
);
logger
.
info
(
"JSAPI下单-结果 => {}"
,
prepay
.
toString
());
String
prepayId
=
prepay
.
getPrepayId
();
JSONObject
payInfo
=
new
JSONObject
();
if
(
StringUtils
.
isNotBlank
(
prepayId
))
{
// 小程序ID
payInfo
.
put
(
"appId"
,
weiXinH5PayConfig
.
getAppId
());
// 时间戳
payInfo
.
put
(
"timeStamp"
,
String
.
valueOf
((
int
)
(
System
.
currentTimeMillis
()
/
1000
)));
// 随机字符串
payInfo
.
put
(
"nonceStr"
,
IdUtils
.
fastSimpleUUID
());
// 订单详情扩展字符串
payInfo
.
put
(
"package"
,
"prepay_id="
+
prepayId
);
// 签名方式
payInfo
.
put
(
"signType"
,
"RSA"
);
// 加密字符串,每行一个参数
String
paySignParam
=
payInfo
.
get
(
"appId"
)
+
"\n"
+
payInfo
.
get
(
"timeStamp"
)
+
"\n"
+
payInfo
.
get
(
"nonceStr"
)
+
"\n"
+
payInfo
.
get
(
"package"
)
+
"\n"
;
// 签名
String
paySign
=
this
.
signRSA
(
paySignParam
,
config
);
payInfo
.
put
(
"paySign"
,
paySign
);
payInfo
.
put
(
"orderNumber"
,
orderSn
);
return
payInfo
;
}
else
{
throw
new
ServiceException
(
"JSAPI下单调起失败"
);
}
}
/***
* 请求H5下单
* @param total 金额
* @param orderSn 订单号
* @param description 描述
* @return 结果
*/
public
String
createH5PayParam
(
BigDecimal
total
,
String
orderSn
,
String
description
)
{
//更新证书配置,这里用官方sdk,不需要考虑时效性问题
Config
config
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
weiXinH5PayConfig
.
getMchId
())
.
privateKey
(
weiXinH5PayConfig
.
getApiClientKey
())
//微信v3-私钥
.
merchantSerialNumber
(
weiXinH5PayConfig
.
getMchSerialNum
())
//微信v3证书序列号
.
apiV3Key
(
weiXinH5PayConfig
.
getApiV3Key
())
//微信v3-apiV3Key
.
build
();
com
.
wechat
.
pay
.
java
.
service
.
payments
.
h5
.
model
.
PrepayRequest
prepayRequest
=
new
com
.
wechat
.
pay
.
java
.
service
.
payments
.
h5
.
model
.
PrepayRequest
();
prepayRequest
.
setMchid
(
weiXinH5PayConfig
.
getMchId
());
prepayRequest
.
setOutTradeNo
(
orderSn
);
prepayRequest
.
setAppid
(
weiXinH5PayConfig
.
getAppId
());
prepayRequest
.
setDescription
(
"学信考试"
);
prepayRequest
.
setNotifyUrl
(
weiXinH5PayConfig
.
getH5NotifyUrl
());
SceneInfo
sceneInfo
=
new
SceneInfo
();
sceneInfo
.
setPayerClientIp
(
IpUtils
.
getIpAddr
());
H5Info
h5Info
=
new
H5Info
();
h5Info
.
setType
(
"Wap"
);
sceneInfo
.
setH5Info
(
h5Info
);
prepayRequest
.
setSceneInfo
(
sceneInfo
);
com
.
wechat
.
pay
.
java
.
service
.
payments
.
h5
.
model
.
Amount
amount
=
new
com
.
wechat
.
pay
.
java
.
service
.
payments
.
h5
.
model
.
Amount
();
amount
.
setTotal
(
total
.
multiply
(
new
BigDecimal
(
"100"
)).
intValue
());
amount
.
setCurrency
(
"CNY"
);
prepayRequest
.
setAmount
(
amount
);
logger
.
info
(
"H5下单-参数 => {}"
,
prepayRequest
);
// 构建请求
H5Service
h5Service
=
new
H5Service
.
Builder
().
config
(
config
).
build
();
com
.
wechat
.
pay
.
java
.
service
.
payments
.
h5
.
model
.
PrepayResponse
response
=
h5Service
.
prepay
(
prepayRequest
);
String
h5Url
=
response
.
getH5Url
();
if
(
StringUtils
.
isNotBlank
(
h5Url
))
{
// h5Url += "&redirect_url="+ URLEncodeUtil.encode("https://h5.chsie.com.cn");
return
h5Url
;
}
else
{
throw
new
ServiceException
(
"H5下单调起失败"
);
}
}
/**
* 微信支付v3签名 RSA签名
*
* @param message 需要签名的内容
* @return 结果
*/
public
String
signRSA
(
String
message
,
Config
config
)
{
try
{
Signer
signer
=
config
.
createSigner
();
SignatureResult
sign
=
signer
.
sign
(
message
);
return
sign
.
getSign
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
/**
* 微信退款(app和小程序通用)
*
* @param out_trade_no 商户订单号
* @param out_refund_no 商户退款单号
* @param refund 退款金额
* @param total 原订单金额
* @return 结果
*/
public
String
weiXinRefund
(
String
out_trade_no
,
String
out_refund_no
,
int
refund
,
int
total
)
{
try
{
//更新证书配置,这里用官方sdk,不需要考虑时效性问题
Config
wxConfig
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
weiXinH5PayConfig
.
getMchId
())
.
privateKey
(
weiXinH5PayConfig
.
getApiClientKey
())
.
merchantSerialNumber
(
weiXinH5PayConfig
.
getMchSerialNum
())
.
apiV3Key
(
weiXinH5PayConfig
.
getApiV3Key
())
.
build
();
AmountReq
amountReq
=
new
AmountReq
();
amountReq
.
setRefund
((
long
)
refund
);
amountReq
.
setTotal
((
long
)
total
);
amountReq
.
setCurrency
(
"CNY"
);
CreateRequest
createRequest
=
new
CreateRequest
();
createRequest
.
setAmount
(
amountReq
);
createRequest
.
setOutRefundNo
(
out_refund_no
);
createRequest
.
setOutTradeNo
(
out_trade_no
);
logger
.
info
(
"JSAPI退款-参数 => "
+
createRequest
.
toString
());
// 发送请求
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
addHeader
(
com
.
wechat
.
pay
.
java
.
core
.
http
.
Constant
.
ACCEPT
,
MediaType
.
APPLICATION_JSON
.
getValue
());
headers
.
addHeader
(
com
.
wechat
.
pay
.
java
.
core
.
http
.
Constant
.
CONTENT_TYPE
,
MediaType
.
APPLICATION_JSON
.
getValue
());
HttpRequest
httpRequest
=
new
HttpRequest
.
Builder
()
.
httpMethod
(
HttpMethod
.
POST
)
.
url
(
"https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"
)
.
headers
(
headers
)
.
body
(
new
JsonRequestBody
.
Builder
().
body
(
com
.
wechat
.
pay
.
java
.
core
.
util
.
GsonUtil
.
toJson
(
createRequest
)).
build
())
.
build
();
HttpClient
httpClient
=
new
DefaultHttpClientBuilder
().
config
(
wxConfig
).
build
();
HttpResponse
<
Refund
>
httpResponse
=
httpClient
.
execute
(
httpRequest
,
Refund
.
class
);
Refund
serviceResponse
=
httpResponse
.
getServiceResponse
();
Status
status
=
serviceResponse
.
getStatus
();
String
name
=
status
.
name
();
if
((
"SUCCESS"
.
equals
(
name
)
||
"PROCESSING"
.
equals
(
name
)))
{
return
"SUCCESS"
;
}
else
{
return
"FAIL"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
"FAIL"
;
}
}
/**
* 解析支付回调参数
*
* @param httpServletRequest 请求
* @return 结果
*/
public
Transaction
getNotifyData
(
HttpServletRequest
httpServletRequest
)
{
try
{
// 请求头Wechatpay-Signature
String
signature
=
httpServletRequest
.
getHeader
(
"Wechatpay-Signature"
);
// 请求头Wechatpay-nonce
String
nonce
=
httpServletRequest
.
getHeader
(
"Wechatpay-Nonce"
);
// 请求头Wechatpay-Timestamp
String
timestamp
=
httpServletRequest
.
getHeader
(
"Wechatpay-Timestamp"
);
// 微信支付证书序列号
String
serial
=
httpServletRequest
.
getHeader
(
"Wechatpay-Serial"
);
// 签名方式
String
signType
=
httpServletRequest
.
getHeader
(
"Wechatpay-Signature-Type"
);
// 获取报文
String
body
=
getRequestBody
(
httpServletRequest
);
// 1.构造 RequestParam
com
.
wechat
.
pay
.
java
.
core
.
notification
.
RequestParam
requestParam
=
new
com
.
wechat
.
pay
.
java
.
core
.
notification
.
RequestParam
.
Builder
()
.
serialNumber
(
serial
)
.
nonce
(
nonce
)
.
signature
(
signature
)
.
timestamp
(
timestamp
)
.
signType
(
signType
)
.
body
(
body
)
.
build
();
// 2. 如果你仍在使用微信支付平台证书,则使用 RSAAutoCertificateConfig
NotificationConfig
wxConfig
=
new
RSAAutoCertificateConfig
.
Builder
()
.
merchantId
(
weiXinH5PayConfig
.
getMchId
())
.
privateKey
(
weiXinH5PayConfig
.
getApiClientKey
())
.
merchantSerialNumber
(
weiXinH5PayConfig
.
getMchSerialNum
())
.
apiV3Key
(
weiXinH5PayConfig
.
getApiV3Key
())
.
build
();
// 初始化 NotificationParser
NotificationParser
parser
=
new
NotificationParser
(
wxConfig
);
// 以支付通知回调为例,验签、解密并转换成 Transaction
return
parser
.
parse
(
requestParam
,
Transaction
.
class
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 读取请求数据流
*
* @param request 请求
* @return 结果
*/
private
String
getRequestBody
(
HttpServletRequest
request
)
{
StringBuilder
sb
=
new
StringBuilder
();
try
(
ServletInputStream
inputStream
=
request
.
getInputStream
();
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
)
{
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
sb
.
toString
();
}
}
ruoyi-common/src/main/java/com/ruoyi/common/weixin/utils/WeiXinPayV3Utils.java
View file @
7fe0d011
...
...
@@ -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
();
// 向证书管理器增加需要自动更新平台证书的商户信息
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/TbExam.java
View file @
7fe0d011
...
...
@@ -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
;
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamMapper.java
View file @
7fe0d011
...
...
@@ -31,6 +31,13 @@ public interface TbExamMapper
*/
public
List
<
TbExam
>
selectTbExamList
(
TbExam
tbExam
);
/**
* 查询考试列表
*
* @return 考试集合
*/
public
List
<
TbExam
>
selectTbExamListAll
();
/**
* 查询考试列表
*
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java
View file @
7fe0d011
...
...
@@ -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
();
});
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamSubjectServiceImpl.java
View file @
7fe0d011
...
...
@@ -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
);
}
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbMemberExamSimulateAllServiceImpl.java
View file @
7fe0d011
...
...
@@ -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
())
+
"】,考试已结束"
);
}
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbMemberSubjectCollectServiceImpl.java
View file @
7fe0d011
...
...
@@ -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
(
","
);
...
...
ruoyi-system/src/main/resources/mapper/hezhi/TbExamMapper.xml
View file @
7fe0d011
...
...
@@ -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>
ruoyi-system/src/main/resources/mapper/hezhi/TbExamNoticeMapper.xml
View file @
7fe0d011
...
...
@@ -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,
...
...
ruoyi-system/src/main/resources/mapper/hezhi/TbMajorClassMapper.xml
View file @
7fe0d011
...
...
@@ -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
...
...
ruoyi-system/src/main/resources/mapper/hezhi/TbStudyCenterMapper.xml
View file @
7fe0d011
...
...
@@ -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>
...
...
ruoyi-ui/src/api/hezhi/link.js
View file @
7fe0d011
...
...
@@ -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
})
}
ruoyi-ui/src/views/hezhi/exam/index.vue
View file @
7fe0d011
...
...
@@ -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
=
"
修改考试
"
;
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment