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
8c0964dc
Commit
8c0964dc
authored
Jun 14, 2025
by
法拉51246
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信邀请码,地图等功能
正在处理多次报名
parent
2262adf3
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
346 additions
and
22 deletions
+346
-22
AlipayService.java
...c/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java
+1
-1
ApiLoginController.java
...n/java/com/ruoyi/hezhi/api/kaoshi/ApiLoginController.java
+35
-3
ApiPCController.java
...main/java/com/ruoyi/hezhi/api/kaoshi/ApiPCController.java
+9
-0
TbStudyCenterController.java
...a/com/ruoyi/hezhi/controller/TbStudyCenterController.java
+14
-0
application.yml
ruoyi-admin/src/main/resources/application.yml
+3
-2
WeiXinConfig.java
...ain/java/com/ruoyi/common/weixin/config/WeiXinConfig.java
+34
-0
TbStudyCenter.java
...m/src/main/java/com/ruoyi/hezhi/domain/TbStudyCenter.java
+9
-0
TbStudyCenterMapper.java
...main/java/com/ruoyi/hezhi/mapper/TbStudyCenterMapper.java
+2
-0
ITbStudentService.java
.../main/java/com/ruoyi/hezhi/service/ITbStudentService.java
+2
-0
ITbStudyCenterService.java
...n/java/com/ruoyi/hezhi/service/ITbStudyCenterService.java
+2
-0
TbStudentServiceImpl.java
...va/com/ruoyi/hezhi/service/impl/TbStudentServiceImpl.java
+131
-9
TbStudyCenterServiceImpl.java
...om/ruoyi/hezhi/service/impl/TbStudyCenterServiceImpl.java
+5
-0
TbCooperatePartnerMapper.xml
.../main/resources/mapper/hezhi/TbCooperatePartnerMapper.xml
+1
-1
TbExamRegistrationMapper.xml
.../main/resources/mapper/hezhi/TbExamRegistrationMapper.xml
+1
-1
TbStudyCenterMapper.xml
...m/src/main/resources/mapper/hezhi/TbStudyCenterMapper.xml
+22
-1
package.json
ruoyi-ui/package.json
+1
-1
index.html
ruoyi-ui/public/index.html
+1
-0
studyCenter.js
ruoyi-ui/src/api/hezhi/studyCenter.js
+9
-0
index.vue
ruoyi-ui/src/views/hezhi/studyCenter/index.vue
+64
-3
No files found.
ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java
View file @
8c0964dc
...
...
@@ -75,7 +75,7 @@ public class AlipayService {
request
.
setBizModel
(
model
);
request
.
setNotifyUrl
(
aliPayConfig
.
getNotifyUrl
()+
"/api/pay/aliPayBoilerNotify"
);
request
.
setReturnUrl
(
"https://www.chsie.com.cn/examDetail?examId="
+
examId
);
//支付成功后跳转回哪个页面
//
request.setReturnUrl("https://www.chsie.com.cn/examDetail?examId="+examId);//支付成功后跳转回哪个页面
AlipayTradePagePayResponse
response
=
alipayClient
.
pageExecute
(
request
,
"POST"
);
// 如果需要返回GET请求,请使用
...
...
ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiLoginController.java
View file @
8c0964dc
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.hezhi.api.kaoshi;
import
cn.hutool.extra.qrcode.QrCodeUtil
;
import
cn.hutool.extra.qrcode.QrConfig
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.google.code.kaptcha.Producer
;
import
com.ruoyi.common.annotation.RateLimiter
;
...
...
@@ -10,9 +11,13 @@ import com.ruoyi.common.constant.CacheConstants;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.redis.RedisCache
;
import
com.ruoyi.common.qiniu.QiNiuUploadUtils
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.sign.Base64
;
import
com.ruoyi.common.utils.txy.TencentSmsCodeUtils
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
com.ruoyi.common.weixin.config.WeiXinConfig
;
import
com.ruoyi.common.weixin.config.WeiXinPayConfig
;
import
com.ruoyi.hezhi.domain.dto.MemberUserLoginDTO
;
import
com.ruoyi.hezhi.domain.dto.SmsCodeDTO
;
...
...
@@ -20,8 +25,11 @@ import com.ruoyi.hezhi.domain.dto.StudentDTO;
import
com.ruoyi.hezhi.service.ITbSmsCodeService
;
import
com.ruoyi.hezhi.service.ITbStudentService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.FastByteArrayOutputStream
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -31,13 +39,17 @@ import javax.annotation.Resource;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.
ByteArrayOutputStream
;
import
java.
io.IOExcep
tion
;
import
java.
io.UnsupportedEncodingException
;
import
java.io.
*
;
import
java.
net.HttpURLConnec
tion
;
import
java.
net.URL
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
static
com
.
ruoyi
.
common
.
constant
.
Constants
.
EXCEPTION_MSG
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
SECONDS
;
/**
* @Author: LCL
* @Date: 2024/10/08
...
...
@@ -63,7 +75,11 @@ public class ApiLoginController {
@Resource
private
WeiXinPayConfig
weiXinPayConfig
;
@Resource
private
WeiXinConfig
weiXinConfig
;
@Resource
ITbStudentService
tbStudentService
;
@Autowired
private
QiNiuUploadUtils
qiNiuUploadUtils
;
/**
...
...
@@ -351,4 +367,20 @@ public class ApiLoginController {
return
AjaxResult
.
success
(
jsonObject
);
}
/**
* 会员码
* @param memberUserId 用户id
* @return 结果
*/
@RepeatSubmit
@GetMapping
(
"/getQrCode"
)
public
AjaxResult
getQrCode
(
String
memberUserId
){
try
{
return
AjaxResult
.
success
(
tbStudentService
.
createQrCode
(
memberUserId
));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
AjaxResult
.
error
(
EXCEPTION_MSG
);
}
}
}
ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/kaoshi/ApiPCController.java
View file @
8c0964dc
...
...
@@ -873,4 +873,13 @@ public class ApiPCController {
return
AjaxResult
.
toAjax
(
tbCourseService
.
delHistoricalRecords
(
dto
));
}
//根据经纬度搜索最近的学习中心
@GetMapping
(
"/getNearbyStudyCenter"
)
public
AjaxResult
getNearbyStudyCenter
(
@RequestParam
(
required
=
false
)
String
latitude
,
@RequestParam
(
required
=
false
)
String
longitude
)
{
StudyCenterVO
nearbyStudyCenter
=
studyCenterService
.
getNearbyStudyCenter
(
latitude
,
longitude
);
return
AjaxResult
.
success
(
nearbyStudyCenter
);
}
}
ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbStudyCenterController.java
View file @
8c0964dc
package
com
.
ruoyi
.
hezhi
.
controller
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
/**
* 学习中心Controller
...
...
@@ -106,4 +109,15 @@ public class TbStudyCenterController extends BaseController
List
<
StudyCenterVO
>
studyCenterVOList
=
tbStudyCenterService
.
getAllStudyCenterList
();
return
AjaxResult
.
success
(
studyCenterVOList
);
}
//地址逆解析
@GetMapping
(
"/api/map/geocoder"
)
public
AjaxResult
getGeocoder
(
@RequestParam
String
lat
,
@RequestParam
String
lng
)
{
String
key
=
"2OZBZ-WUCE7-SLKXP-HJVOW-3P6RF-WVB7H"
;
String
url
=
"https://apis.map.qq.com/ws/geocoder/v1/?location="
+
lat
+
","
+
lng
+
"&key="
+
key
;
String
json
=
HttpUtil
.
get
(
url
);
return
AjaxResult
.
success
(
JSON
.
parseObject
(
json
));
}
}
ruoyi-admin/src/main/resources/application.yml
View file @
8c0964dc
...
...
@@ -211,9 +211,10 @@ wx:
# 小程序id
appId
:
wx8de56186c26a6a76
# 小程序密钥
appSecret
:
4778276c6b80b6e6745f37e04f11d991
# appSecret: 4778276c6b80b6e6745f37e04f11d991
appSecret
:
af6b5009cdaebc647c5d6327ad25e848
# 小程序码跳转页面
wxPath
:
pages/
index
/index?higherUserId=
wxPath
:
pages/
homePage
/index?higherUserId=
# 二维码跳转
qrCodeLink
:
https://server.xuexin.com/miniprogram/
# 小程序发货
...
...
ruoyi-common/src/main/java/com/ruoyi/common/weixin/config/WeiXinConfig.java
0 → 100644
View file @
8c0964dc
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
;
/**
* 微信相关参数配置
* @author Wzp
*/
@Getter
@Setter
@Configuration
public
class
WeiXinConfig
{
@Value
(
"${wx.miniProgram.appId}"
)
private
String
appId
;
@Value
(
"${wx.miniProgram.appSecret}"
)
private
String
appSecret
;
@Value
(
"${wx.miniProgram.wxPath}"
)
private
String
wxPath
;
@Value
(
"${wx.miniProgram.qrCodeLink}"
)
private
String
qrCodeLink
;
@Value
(
"${wx.miniProgram.deliveryUrl}"
)
private
String
deliveryUrl
;
@Value
(
"${wx.pay.mchId}"
)
private
String
mchId
;
}
ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/TbStudyCenter.java
View file @
8c0964dc
...
...
@@ -7,6 +7,7 @@ import lombok.Getter;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -122,6 +123,14 @@ public class TbStudyCenter extends BaseEntity
@Excel
(
name
=
"区名"
)
private
String
areaName
;
/** 纬度 */
@Excel
(
name
=
"纬度"
)
private
BigDecimal
latitude
;
/** 经度 */
@Excel
(
name
=
"经度"
)
private
BigDecimal
longitude
;
/** 详细地址 */
@Excel
(
name
=
"详细地址"
)
private
String
address
;
...
...
ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbStudyCenterMapper.java
View file @
8c0964dc
...
...
@@ -109,4 +109,6 @@ public interface TbStudyCenterMapper
* @return List<StudyCenterVO>
*/
List
<
StudyCenterVO
>
getStudyListByCourse
(
@Param
(
"courseId"
)
Long
courseId
);
StudyCenterVO
getNearbyStudyCenter
(
@Param
(
"latitude"
)
String
latitude
,
@Param
(
"longitude"
)
String
longitude
);
}
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/ITbStudentService.java
View file @
8c0964dc
...
...
@@ -137,4 +137,6 @@ public interface ITbStudentService
JSONObject
memberUserRegister
(
MemberUserLoginDTO
memberUserLoginDTO
);
int
editPassword
(
TbStudent
tbStudent
);
String
createQrCode
(
String
memberUserId
);
}
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/ITbStudyCenterService.java
View file @
8c0964dc
...
...
@@ -99,4 +99,6 @@ public interface ITbStudyCenterService
public
List
<
Map
<
String
,
Object
>>
getStudyCenterEvaluateAgencyList
(
Long
studyCenterId
);
public
PageInfo
<
Map
<
String
,
Object
>>
getStudyCenterCourseList
(
Integer
pageNum
,
Integer
pageSize
,
Long
studyCenterId
,
Long
evaluateAgencyId
);
StudyCenterVO
getNearbyStudyCenter
(
String
latitude
,
String
longitude
);
}
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbStudentServiceImpl.java
View file @
8c0964dc
...
...
@@ -3,17 +3,16 @@ package com.ruoyi.hezhi.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.common.constant.CacheConstants
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.redis.RedisCache
;
import
com.ruoyi.common.enums.ServiceResponseEnum
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.RSAUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.*
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
com.ruoyi.common.weixin.config.WeiXinConfig
;
import
com.ruoyi.common.weixin.config.WeiXinXcxMemberConfig
;
import
com.ruoyi.common.weixin.utils.WeiXinXcxMemberUtils
;
import
com.ruoyi.hezhi.domain.TbStudent
;
...
...
@@ -24,23 +23,26 @@ import com.ruoyi.hezhi.mapper.TbStudentMapper;
import
com.ruoyi.hezhi.service.ITbSmsCodeService
;
import
com.ruoyi.hezhi.service.ITbStudentService
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.ibatis.session.ExecutorType
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
java.time.LocalDateTime
;
import
java.awt.*
;
import
java.io.BufferedInputStream
;
import
java.io.PrintWriter
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.*
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
SECONDS
;
/**
* 学员Service业务层处理
*
...
...
@@ -61,6 +63,8 @@ public class TbStudentServiceImpl implements ITbStudentService {
private
WeiXinXcxMemberConfig
weiXinXcxMemberConfig
;
@Resource
private
SqlSessionFactory
sqlSessionFactory
;
@Resource
private
WeiXinConfig
weiXinConfig
;
/**
* 查询学员
...
...
@@ -764,4 +768,122 @@ public class TbStudentServiceImpl implements ITbStudentService {
return
tbStudentMapper
.
updateTbStudent
(
tbStudent
);
}
@Override
public
String
createQrCode
(
String
memberUserId
)
{
if
(
StringUtils
.
isBlank
(
memberUserId
)){
return
""
;
}
// 查询用户信息
TbStudent
tbMemberUser
=
tbStudentMapper
.
selectTbStudentByStudentId
(
Long
.
valueOf
(
memberUserId
));
if
(
ObjectUtils
.
isNotEmpty
(
tbMemberUser
)){
String
qrCode
=
tbMemberUser
.
getInvitationCodeImg
();
//获取邀请码图
if
(
StringUtils
.
isNotBlank
(
qrCode
)){
return
qrCode
;
}
}
String
userAvatar
=
""
;
String
qrCode
=
""
;
Image
image
=
null
;
if
(
ObjectUtils
.
isNotEmpty
(
tbMemberUser
)){
// 生成二维码
String
key
=
"qr_"
+
IdUtils
.
fastSimpleUUID
()
+
".png"
;
qrCode
=
this
.
getQRCode
(
memberUserId
,
key
);
tbMemberUser
.
setInvitationCodeImg
(
qrCode
);
tbMemberUser
.
setUpdateTime
(
DateUtils
.
getNowDate
());
tbStudentMapper
.
updateTbStudent
(
tbMemberUser
);
}
return
qrCode
;
}
/**
* 获取小程序码
*
* @param memberUserId 用户id
* @param key key
* @return 图片链接
*/
public
String
getQRCode
(
String
memberUserId
,
String
key
){
String
qrCodeUrl
=
""
;
try
{
//获取token
String
accessToken
=
this
.
getAccessToken
();
String
codeUrl
=
"https://api.weixin.qq.com/wxa/getwxacode?access_token="
+
accessToken
;
String
path
=
weiXinConfig
.
getWxPath
()+
memberUserId
;
//post参数
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"path"
,
path
);
Map
<
String
,
Object
>
lineColor
=
new
HashMap
<>();
lineColor
.
put
(
"r"
,
4
);
lineColor
.
put
(
"g"
,
157
);
lineColor
.
put
(
"b"
,
150
);
jsonObject
.
put
(
"line_color"
,
lineColor
);
jsonObject
.
put
(
"env_version"
,
"trial"
);
String
params
=
jsonObject
.
toString
();
URL
url
=
new
URL
(
codeUrl
);
HttpURLConnection
httpUrlConnection
=
(
HttpURLConnection
)
url
.
openConnection
();
// 提交模式
httpUrlConnection
.
setRequestMethod
(
"POST"
);
// 发送POST请求必须设置如下两行
httpUrlConnection
.
setDoOutput
(
true
);
httpUrlConnection
.
setDoInput
(
true
);
// 获取URLConnection对象对应的输出流
PrintWriter
printWriter
=
new
PrintWriter
(
httpUrlConnection
.
getOutputStream
());
printWriter
.
write
(
params
);
printWriter
.
flush
();
//获取数据
BufferedInputStream
bis
=
new
BufferedInputStream
(
httpUrlConnection
.
getInputStream
());
//文件上传,返回小程序码url
qrCodeUrl
=
new
ImgUpload
().
uploadStream
(
bis
,
key
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
qrCodeUrl
;
}
/**
* 获取access_token
*
* @return access_token
*/
public
String
getAccessToken
()
{
JSONObject
jsonObject
=
new
JSONObject
();
String
accessToken
=
""
;
String
redisKey
=
"xcx:access_token:"
;
try
{
if
(
redisCache
.
hasKey
(
redisKey
))
{
return
redisCache
.
getCacheObject
(
redisKey
).
toString
();
}
String
requestUrl
=
"https://api.weixin.qq.com/cgi-bin/token"
+
"?grant_type=client_credential"
+
"&appid="
+
weiXinConfig
.
getAppId
()
+
"&secret="
+
weiXinConfig
.
getAppSecret
();
String
result
=
HttpUtil
.
get
(
requestUrl
);
jsonObject
=
JSONObject
.
parseObject
(
result
);
// 有效期(s)
Integer
expiresIn
=
0
;
if
(
ObjectUtils
.
isNotEmpty
(
jsonObject
))
{
accessToken
=
jsonObject
.
getString
(
"access_token"
);
expiresIn
=
jsonObject
.
getInteger
(
"expires_in"
);
}
if
(
StringUtils
.
isBlank
(
accessToken
)){
System
.
out
.
println
(
"小程序获取access_token失败 -> {"
+
DateUtils
.
getTime
()+
": "
+
jsonObject
+
"}"
);
}
else
{
redisCache
.
setCacheObject
(
redisKey
,
accessToken
,
expiresIn
,
SECONDS
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"小程序获取access_token异常 -> {"
+
DateUtils
.
getTime
()+
": "
+
e
.
getMessage
()+
"}"
);
}
return
accessToken
;
}
}
ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbStudyCenterServiceImpl.java
View file @
8c0964dc
...
...
@@ -332,4 +332,9 @@ public class TbStudyCenterServiceImpl implements ITbStudyCenterService
List
<
Map
<
String
,
Object
>>
studyCenterCourseList
=
tbExamCourseMapper
.
getStudyCenterCourseList
(
studyCenterId
,
evaluateAgencyId
);
return
new
PageInfo
<>(
studyCenterCourseList
);
}
@Override
public
StudyCenterVO
getNearbyStudyCenter
(
String
latitude
,
String
longitude
)
{
return
tbStudyCenterMapper
.
getNearbyStudyCenter
(
latitude
,
longitude
);
}
}
ruoyi-system/src/main/resources/mapper/hezhi/TbCooperatePartnerMapper.xml
View file @
8c0964dc
...
...
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"deleteBy != null and deleteBy != ''"
>
and delete_by = #{deleteBy}
</if>
<if
test=
"delFlag != null "
>
and del_flag = #{delFlag}
</if>
</where>
or
or
der by create_time desc
order by create_time desc
</select>
<select
id=
"selectTbCooperatePartnerByCooperatePartnerId"
parameterType=
"Long"
resultMap=
"TbCooperatePartnerResult"
>
...
...
ruoyi-system/src/main/resources/mapper/hezhi/TbExamRegistrationMapper.xml
View file @
8c0964dc
...
...
@@ -1094,7 +1094,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ter.pay_type AS payType,
CONVERT(IFNULL(te.name, ''), CHAR) AS examName,
t
mo
.pay_price AS payPrice,
t
er
.pay_price AS payPrice,
CONVERT(IFNULL(ter.registration_batch, ''), CHAR) AS registrationBatch,
CONVERT(IFNULL(DATE_FORMAT(teb.exam_start_time,'%Y-%m-%d %H:%i:%s'), ''), CHAR) AS examStartTime,
CONVERT(IFNULL(DATE_FORMAT(teb.exam_end_time,'%Y-%m-%d %H:%i:%s'), ''), CHAR) AS examEndTime,
...
...
ruoyi-system/src/main/resources/mapper/hezhi/TbStudyCenterMapper.xml
View file @
8c0964dc
...
...
@@ -51,10 +51,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"deleteTime"
column=
"delete_time"
/>
<result
property=
"deleteBy"
column=
"delete_by"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"latitude"
column=
"latitude"
/>
<result
property=
"longitude"
column=
"longitude"
/>
</resultMap>
<sql
id=
"selectTbStudyCenterVo"
>
select study_center_id, sys_user_id, study_center_class_id, continuing_education_class_id, study_center_number, study_center_logo, study_center_background, school_name, study_center_name, study_center_title, study_center_describe, study_center_tag, study_center_introduce, recommend_course, superintendent, phone, enterprise_name, business_license_credit_code, business_license_img, province_id, city_id, area_id, province_name, city_name, area_name, address, type, examine_status, examine_feedback, frozen_status, frozen_feedback, is_recommend,teacher_name,teacher_phone, sort, remarks, status, publication_time, publisher, create_time, create_by, update_time, update_by, delete_time, delete_by, del_flag from tb_study_center
select study_center_id, sys_user_id, study_center_class_id, continuing_education_class_id, study_center_number, study_center_logo, study_center_background, school_name, study_center_name, study_center_title, study_center_describe, study_center_tag, study_center_introduce, recommend_course, superintendent, phone, enterprise_name, business_license_credit_code, business_license_img, province_id, city_id, area_id, province_name, city_name, area_name, address,
latitude,longitude,
type, examine_status, examine_feedback, frozen_status, frozen_feedback, is_recommend,teacher_name,teacher_phone, sort, remarks, status, publication_time, publisher, create_time, create_by, update_time, update_by, delete_time, delete_by, del_flag from tb_study_center
</sql>
<select
id=
"selectTbStudyCenterList"
parameterType=
"TbStudyCenter"
resultMap=
"TbStudyCenterResult"
>
...
...
@@ -177,6 +179,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"deleteTime != null"
>
delete_time,
</if>
<if
test=
"deleteBy != null"
>
delete_by,
</if>
<if
test=
"delFlag != null"
>
del_flag,
</if>
<if
test=
"latitude != null"
>
latitude,
</if>
<if
test=
"longitude != null"
>
longitude,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sysUserId != null"
>
#{sysUserId},
</if>
...
...
@@ -224,6 +228,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"deleteTime != null"
>
#{deleteTime},
</if>
<if
test=
"deleteBy != null"
>
#{deleteBy},
</if>
<if
test=
"delFlag != null"
>
#{delFlag},
</if>
<if
test=
"latitude != null"
>
#{latitude},
</if>
<if
test=
"longitude != null"
>
#{longitude},
</if>
</trim>
</insert>
...
...
@@ -275,6 +281,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"deleteTime != null"
>
delete_time = #{deleteTime},
</if>
<if
test=
"deleteBy != null"
>
delete_by = #{deleteBy},
</if>
<if
test=
"delFlag != null"
>
del_flag = #{delFlag},
</if>
<if
test=
"latitude != null"
>
latitude = #{latitude},
</if>
<if
test=
"longitude != null"
>
longitude = #{longitude},
</if>
</trim>
where study_center_id = #{studyCenterId}
</update>
...
...
@@ -371,4 +379,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND tsc.del_flag = 0 -- 确保没有被标记为删除
</select>
<select
id=
"getNearbyStudyCenter"
resultType=
"com.ruoyi.hezhi.domain.vo.StudyCenterVO"
>
select study_center_id as studyCenterId,study_center_name as studyCenterName,
latitude,
longitude,
( 6371 * acos( cos( radians(#{latitude}) )
* cos( radians( latitude ) )
* cos( radians( longitude ) - radians(#{longitude}) )
+ sin( radians(#{latitude}) )
* sin( radians( latitude ) ) ) ) AS distance
FROM tb_study_center
ORDER BY distance
LIMIT 1;
</select>
</mapper>
ruoyi-ui/package.json
View file @
8c0964dc
...
...
@@ -57,7 +57,7 @@
"vue"
:
"^2.7.16"
,
"vue-count-to"
:
"1.0.13"
,
"vue-cropper"
:
"0.5.5"
,
"vue-meta"
:
"2.4.0"
,
"vue-meta"
:
"
^
2.4.0"
,
"vue-router"
:
"3.4.9"
,
"vuedraggable"
:
"2.24.3"
,
"vuex"
:
"3.6.0"
,
...
...
ruoyi-ui/public/index.html
View file @
8c0964dc
...
...
@@ -5,6 +5,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<meta
name=
"renderer"
content=
"webkit"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
>
<meta
http-equiv=
"Permissions-Policy"
content=
"geolocation=(self)"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<title><
%=
webpackConfig
.
name
%
></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
...
...
ruoyi-ui/src/api/hezhi/studyCenter.js
View file @
8c0964dc
...
...
@@ -50,3 +50,12 @@ export function getAllStudyCenterList() {
method
:
'
get
'
,
})
}
// 地址逆解析
export
function
getMapGeocoder
(
params
)
{
return
request
({
url
:
'
/hezhi/studyCenter/api/map/geocoder
'
,
method
:
'
get
'
,
params
:
params
})
}
ruoyi-ui/src/views/hezhi/studyCenter/index.vue
View file @
8c0964dc
...
...
@@ -347,9 +347,28 @@
<!-- <el-form-item label="区名" prop="areaName">-->
<!-- <el-input v-model="form.areaName" placeholder="请输入区名" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="详细地址" prop="address">-->
<!-- <el-input v-model="form.address" placeholder="请输入详细地址" />-->
<!-- </el-form-item>-->
<el-form-item
label=
"详细地址"
prop=
"address"
>
<el-input
v-model=
"form.address"
placeholder=
"请输入详细地址"
/>
<el-input
v-model=
"form.address"
placeholder=
"点击右侧选择地址后可进行编辑"
:readonly=
"!form.address"
>
<
template
#append
>
<!-- 选择地址按钮 -->
<el-button
type=
"primary"
@
click=
"openMapPicker"
>
选择地址
</el-button>
</
template
>
</el-input>
</el-form-item>
<MapPicker
ref=
"mapPickerRef"
@
update-location=
"handleLocation"
/>
<!-- <el-form-item label="审核反馈" prop="examineFeedback">-->
<!-- <el-input v-model="form.examineFeedback" type="textarea" placeholder="请输入内容" />-->
...
...
@@ -414,7 +433,7 @@ import {
getStudyCenter
,
delStudyCenter
,
addStudyCenter
,
updateStudyCenter
,
updateStudyCenter
,
getMapGeocoder
,
}
from
"
@/api/hezhi/studyCenter
"
;
import
{
getAllStudyCenterClassList
}
from
"
@/api/hezhi/studyCenterClass
"
;
import
{
getCityOrArea
,
getProvince
}
from
"
@/api/hezhi/region
"
;
...
...
@@ -422,6 +441,7 @@ import StudyCenterFile from "@/views/hezhi/studyCenterFile";
import
{
getAllContinuingEducationClassList
}
from
"
@/api/hezhi/continuingEducationClass
"
;
import
ExamCourse
from
"
@/components/ExamCourse/index.vue
"
;
import
StudyCenterTeacher
from
"
@/views/hezhi/studyCenter/studyCenterTeacher.vue
"
;
import
MapPicker
from
"
@/views/hezhi/studyCenter/MapPicker.vue
"
;
export
default
{
name
:
"
StudyCenter
"
,
...
...
@@ -431,7 +451,7 @@ export default {
"
tb_frozen_status
"
,
"
tb_is_recommend
"
,
],
components
:
{
StudyCenterTeacher
,
ExamCourse
,
StudyCenterFile
},
components
:
{
StudyCenterTeacher
,
ExamCourse
,
StudyCenterFile
,
MapPicker
},
data
()
{
return
{
value6
:
""
,
...
...
@@ -513,6 +533,9 @@ export default {
studyCenterName
:
[
{
required
:
true
,
message
:
"
学习中心名称
"
,
trigger
:
"
blur
"
},
],
address
:
[
{
required
:
true
,
message
:
"
地址不能为空
"
,
trigger
:
"
change
"
},
],
},
studyCenterId
:
null
,
continuingEducationClassList
:
[],
...
...
@@ -613,6 +636,8 @@ export default {
cityName
:
null
,
areaName
:
null
,
address
:
null
,
latitude
:
null
,
longitude
:
null
,
type
:
null
,
examineStatus
:
null
,
examineFeedback
:
null
,
...
...
@@ -726,6 +751,42 @@ export default {
`studyCenter_
${
new
Date
().
getTime
()}
.xlsx`
);
},
// 调用子组件的 open 方法打开弹窗
openMapPicker
()
{
this
.
$refs
.
mapPickerRef
.
open
();
},
handleLocation
({
lat
,
lng
,
address
})
{
console
.
log
(
'
lat:
'
,
lat
,
'
lng:
'
,
lng
,
'
address:
'
,
address
);
// 经纬度和地址名称
this
.
form
.
latitude
=
lat
;
this
.
form
.
longitude
=
lng
;
this
.
form
.
address
=
address
;
// 逆地址解析
// const params = {
// lat: lat,
// lng: lng
// };
// 模拟 homesApi.getMapGeocoder 的异步调用
// getMapGeocoder(params)
// .then((res) => {
// console.log('逆地址解析结果:', res);
// if (res.status === 0) {
// const comp = res.result.address_component;
// // 赋值到 formData
// this.form.provinceName = comp.province || '';
// this.form.cityName = comp.city || '';
// this.form.areaName = comp.district || '';
//
// } else {
// console.warn('逆地址解析失败:', res.data.message);
// }
// })
// .catch((err) => {
// console.log(err);
// });
}
},
};
</
script
>
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