Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dd_school
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqi
dd_school
Commits
ec9467a6
Commit
ec9467a6
authored
Aug 25, 2023
by
zhaopanyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 49.232.152.146:xhxy/smart_school
parents
df859a30
22a84411
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
10 deletions
+117
-10
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+1
-1
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/schoolEquipment/EquipmentLedgerServiceImpl.java
+3
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/schoolXxfb/SchoolXxfbServiceImpl.java
+7
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/util/VxTemlateSendApi.java
+4
-3
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/api/WxApiController.java
+94
-2
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/student/WxSchoolStudentIntegralController.java
+6
-2
smart-campus/src/main/java/yangtz/cs/liu/wechat/utils/AccessTokenUtil.java
+2
-2
No files found.
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
View file @
ec9467a6
...
@@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 静态资源,可匿名访问
// 静态资源,可匿名访问
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
.
antMatchers
(
"/wx/wxchat"
,
"/wx/getCode"
,
"/wx/callback"
,
"/wx/getAccessToken"
,
"/wx/sendTemplate"
).
permitAll
()
.
antMatchers
(
"/wx/wxchat"
,
"/wx/getCode"
,
"/wx/callback"
,
"/wx/getAccessToken"
,
"/wx/sendTemplate"
,
"/wx/getsignature"
).
permitAll
()
//activiti相关接口放行
//activiti相关接口放行
.
antMatchers
(
"/modeler/**"
).
anonymous
()
.
antMatchers
(
"/modeler/**"
).
anonymous
()
.
antMatchers
(
"/activiti/definition/upload"
).
anonymous
()
.
antMatchers
(
"/activiti/definition/upload"
).
anonymous
()
...
...
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/schoolEquipment/EquipmentLedgerServiceImpl.java
View file @
ec9467a6
...
@@ -127,6 +127,9 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
...
@@ -127,6 +127,9 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
String
userName
=
sysUserMapper
.
selectUserById
(
schoolEquipmentLedger
.
getUseId
()).
getUserName
();
String
userName
=
sysUserMapper
.
selectUserById
(
schoolEquipmentLedger
.
getUseId
()).
getUserName
();
schoolEquipmentLedger
.
setUseName
(
userName
);
schoolEquipmentLedger
.
setUseName
(
userName
);
}
}
if
(
schoolEquipmentLedger
.
getClassificationCode
().
length
()
<
4
){
throw
new
ServiceException
(
"分类编码至少选择至二级分类!"
);
}
//生成自编码
//生成自编码
String
code
=
getCode
(
schoolEquipmentLedger
.
getClassificationCode
());
String
code
=
getCode
(
schoolEquipmentLedger
.
getClassificationCode
());
schoolEquipmentLedger
.
setEncode
(
code
);
schoolEquipmentLedger
.
setEncode
(
code
);
...
...
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/schoolXxfb/SchoolXxfbServiceImpl.java
View file @
ec9467a6
...
@@ -26,6 +26,7 @@ import yangtz.cs.liu.wechat.vo.schoolXxfb.SchoolXxfbVo;
...
@@ -26,6 +26,7 @@ import yangtz.cs.liu.wechat.vo.schoolXxfb.SchoolXxfbVo;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ObjectUtils
.
isNotNull
;
import
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ObjectUtils
.
isNotNull
;
import
static
yangtz
.
cs
.
liu
.
campus
.
constant
.
XxfbConstant
.
SAVE
;
import
static
yangtz
.
cs
.
liu
.
campus
.
constant
.
XxfbConstant
.
SAVE
;
...
@@ -74,6 +75,12 @@ public class SchoolXxfbServiceImpl extends ServiceImpl<SchoolXxfbMapper, SchoolX
...
@@ -74,6 +75,12 @@ public class SchoolXxfbServiceImpl extends ServiceImpl<SchoolXxfbMapper, SchoolX
if
(!(
"姓名"
.
equals
(
titles
.
get
(
1
))))
{
if
(!(
"姓名"
.
equals
(
titles
.
get
(
1
))))
{
throw
new
ServiceException
(
"第2列表头应为姓名"
);
throw
new
ServiceException
(
"第2列表头应为姓名"
);
}
}
//判断表头是否有重复
//去重表头集合 去重之后如果新的表头集合和原表头集合长度一致,则表头没有重复值
List
<
String
>
titlesX
=
titles
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
if
(
titlesX
.
size
()
!=
titles
.
size
()){
throw
new
ServiceException
(
"列名不能重复,请检查!"
);
}
//获取表内容
//获取表内容
//拿第一个sheet表
//拿第一个sheet表
...
...
smart-campus/src/main/java/yangtz/cs/liu/campus/util/VxTemlateSendApi.java
View file @
ec9467a6
...
@@ -23,7 +23,7 @@ public class VxTemlateSendApi {
...
@@ -23,7 +23,7 @@ public class VxTemlateSendApi {
/**
/**
* 测试环境路径
* 测试环境路径
*/
*/
private
static
String
url
=
"http://
urgb7d
.natappfree.cc/houduan/vx/temlateses/sendTemlate"
;
private
static
String
url
=
"http://
xrwpuc
.natappfree.cc/houduan/vx/temlateses/sendTemlate"
;
/**
/**
* 签名key
* 签名key
...
@@ -44,13 +44,14 @@ public class VxTemlateSendApi {
...
@@ -44,13 +44,14 @@ public class VxTemlateSendApi {
* @return
* @return
*/
*/
public
static
String
sendVxTemlate
(
Map
<
String
,
Object
>
map
){
public
static
String
sendVxTemlate
(
Map
<
String
,
Object
>
map
){
long
timestamp
=
System
.
currentTimeMillis
();
CheckUtil
checkUtil
=
new
CheckUtil
(
ticketSecrets
);
CheckUtil
checkUtil
=
new
CheckUtil
(
ticketSecrets
);
checkUtil
.
setMap
(
map
);
checkUtil
.
setMap
(
map
);
checkUtil
.
setValue
(
"timeStamp"
,
new
Date
().
getTime
()/
1000
);
checkUtil
.
setValue
(
"timeStamp"
,
timestamp
);
VerificationCodeParam
verificationCodeParam
=
new
VerificationCodeParam
();
VerificationCodeParam
verificationCodeParam
=
new
VerificationCodeParam
();
verificationCodeParam
.
setSign
(
checkUtil
.
makeSign
());
verificationCodeParam
.
setSign
(
checkUtil
.
makeSign
());
verificationCodeParam
.
setMap
(
map
);
verificationCodeParam
.
setMap
(
map
);
verificationCodeParam
.
setTimeStamp
(
Long
.
valueOf
(
new
Date
().
getTime
()/
1000
)
);
verificationCodeParam
.
setTimeStamp
(
timestamp
);
String
jsonString
=
JSON
.
toJSONString
(
verificationCodeParam
);
String
jsonString
=
JSON
.
toJSONString
(
verificationCodeParam
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jsonString
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jsonString
);
String
post
=
HttpUtils
.
sendJsonPost
(
url
,
jsonObject
);
String
post
=
HttpUtils
.
sendJsonPost
(
url
,
jsonObject
);
...
...
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/api/WxApiController.java
View file @
ec9467a6
...
@@ -10,6 +10,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
...
@@ -10,6 +10,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
import
com.ruoyi.common.core.redis.RedisCache
;
import
com.ruoyi.common.core.redis.RedisCache
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.http.HttpUtils
;
import
java.util.concurrent.TimeUnit
;
import
javax.servlet.http.HttpServletRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -17,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -17,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
yangtz.cs.liu.campus.util.VxTemlateSendApi
;
import
yangtz.cs.liu.wechat.conf.AesException
;
import
yangtz.cs.liu.wechat.conf.AesException
;
import
yangtz.cs.liu.wechat.conf.SHA1
;
import
yangtz.cs.liu.wechat.conf.SHA1
;
import
yangtz.cs.liu.wechat.domain.*
;
import
yangtz.cs.liu.wechat.domain.*
;
...
@@ -290,6 +294,94 @@ public class WxApiController extends BaseController {
...
@@ -290,6 +294,94 @@ public class WxApiController extends BaseController {
// }
// }
}
}
/*
* 发送发膜
* toUserOpenId 微信用户id applyTime 申请时间 remark 备注 applyUser 用户名字 content 内容 first 标题
*/
// @GetMapping("/sendTemlp")
// private AjaxResult sendTemlp(){
// Map<String,Object> map = new HashMap();
// map.put("toUserOpenId","oTrVl6iMzcAET3T-T_c3jdULe9YM");
// map.put("applyTime","2023-05-20 15:20:30");
// map.put("remark","测试");
// map.put("applyUser","测试");
// map.put("content","1111111");
// map.put("first","测试标题");
// VxTemlateSendApi.sendVxTemlate(map);
// return AjaxResult.success();
// }
/**
* 获取签名 noncestr timestamp signature
* @return
*/
@GetMapping
(
"/getsignature"
)
@ResponseBody
public
AjaxResult
getsignature
(
String
url
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
//获取accesToken
String
token
=
accessTokenUtil
.
getToken
();
//获取jsapi_ticket
String
ticket
=
null
;
ticket
=
redisCache
.
getCacheObject
(
"ticket"
);
if
(
StringUtils
.
isEmpty
(
ticket
)){
String
ticketss
=
HttpUtils
.
sendGet
(
"https://api.weixin.qq.com/cgi-bin/ticket/getticket?"
+
"access_token="
+
token
+
"&type=jsapi"
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
ticketss
);
ticket
=
jsonObject
.
get
(
"ticket"
).
toString
();
redisCache
.
setCacheObject
(
"ticket"
,
ticket
,
5
,
TimeUnit
.
MINUTES
);
}
//生成JS-SDK权限验证的签名
//1.生成随机字符串
String
uuid
=
UUID
.
randomUUID
().
toString
();
//去掉“-”符号
String
noncester
=
uuid
.
replaceAll
(
"-"
,
""
);
//2获取时间戳
long
timestamp
=
System
.
currentTimeMillis
();
//3.
Map
<
String
,
String
>
maps
=
new
TreeMap
<
String
,
String
>();
maps
.
put
(
"noncestr"
,
noncester
);
maps
.
put
(
"jsapi_ticket"
,
ticket
);
maps
.
put
(
"timestamp"
,
String
.
valueOf
(
timestamp
));
maps
.
put
(
"url"
,
url
);
String
createLinkString
=
createLinkString
(
maps
);
log
.
info
(
createLinkString
);
//sha1签名,得到signature
String
signature
=
Sha1Util
.
sha1
(
createLinkString
);
map
.
put
(
"noncestr"
,
noncester
);
map
.
put
(
"jsapi_ticket"
,
ticket
);
map
.
put
(
"timestamp"
,
String
.
valueOf
(
timestamp
));
map
.
put
(
"url"
,
url
);
map
.
put
(
"signature"
,
signature
);
return
AjaxResult
.
success
(
map
);
}
/**
* a把数组所有元素排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串
* @param params 需要排序并参与字符拼接的参数组
* @return 拼接后字符串
*/
public
static
String
createLinkString
(
Map
<
String
,
String
>
params
)
{
List
<
String
>
keys
=
new
ArrayList
<
String
>(
params
.
keySet
());
Collections
.
sort
(
keys
);
String
prestr
=
""
;
for
(
int
i
=
0
;
i
<
keys
.
size
();
i
++)
{
String
key
=
keys
.
get
(
i
);
String
value
=
params
.
get
(
key
);
if
(
i
==
keys
.
size
()
-
1
)
{
// 拼接时,不包括最后一个&字符
prestr
=
prestr
+
key
+
"="
+
value
;
}
else
{
prestr
=
prestr
+
key
+
"="
+
value
+
"&"
;
}
}
return
prestr
;
}
/**
/**
{
{
"button": [
"button": [
...
@@ -500,10 +592,10 @@ public class WxApiController extends BaseController {
...
@@ -500,10 +592,10 @@ public class WxApiController extends BaseController {
+
code
+
code
+
"&grant_type=authorization_code"
;
+
"&grant_type=authorization_code"
;
String
result
=
HttpUtil
.
get
(
url
);
String
result
=
HttpUtil
.
get
(
url
);
log
.
info
(
"urlRespons:"
+
result
);
// 将结果解析为json
// 将结果解析为json
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
System
.
out
.
println
(
result
);
//
System.out.println(result);
String
openId
=
jsonObject
.
getStr
(
"openid"
);
String
openId
=
jsonObject
.
getStr
(
"openid"
);
// if (StringUtils.isEmpty(openId)) {
// if (StringUtils.isEmpty(openId)) {
...
...
smart-campus/src/main/java/yangtz/cs/liu/wechat/controller/student/WxSchoolStudentIntegralController.java
View file @
ec9467a6
...
@@ -37,7 +37,7 @@ public class WxSchoolStudentIntegralController extends BaseController {
...
@@ -37,7 +37,7 @@ public class WxSchoolStudentIntegralController extends BaseController {
@GetMapping
(
"/list/{studentId}"
)
@GetMapping
(
"/list/{studentId}"
)
public
AjaxResult
list
(
@PathVariable
Long
studentId
,
SchoolStudentIntegral
schoolStudentIntegral
)
public
AjaxResult
list
(
@PathVariable
Long
studentId
,
SchoolStudentIntegral
schoolStudentIntegral
)
{
{
// TODO 获取当前学年,所在学期(未改)
//获取当前学年,所在学期
//获取当前学年,所在学期
int
term
=
isNewTerm
();
int
term
=
isNewTerm
();
int
schoolYear
=
getNewYear
();
int
schoolYear
=
getNewYear
();
...
@@ -46,7 +46,11 @@ public class WxSchoolStudentIntegralController extends BaseController {
...
@@ -46,7 +46,11 @@ public class WxSchoolStudentIntegralController extends BaseController {
schoolStudentIntegral
.
setSchoolYear
(
schoolYear
);
schoolStudentIntegral
.
setSchoolYear
(
schoolYear
);
//该学生本学年当前学期积分列表
//该学生本学年当前学期积分列表
List
<
SchoolStudentIntegral
>
list
=
integralService
.
selectSchoolStudentIntegralList
(
schoolStudentIntegral
);
List
<
SchoolStudentIntegral
>
list
=
integralService
.
selectSchoolStudentIntegralList
(
schoolStudentIntegral
);
AjaxResult
ajax
=
AjaxResult
.
success
(
list
);
// TODO 修改公众号查询学生积分明细 获取该学生所有学期积分列表
SchoolStudentIntegral
studentIntegral
=
new
SchoolStudentIntegral
();
studentIntegral
.
setStudentId
(
studentId
);
List
<
SchoolStudentIntegral
>
studentIntegralList
=
integralService
.
selectSchoolStudentIntegralList
(
studentIntegral
);
AjaxResult
ajax
=
AjaxResult
.
success
(
studentIntegralList
);
//班级得分 classScore
//班级得分 classScore
// ,级部得分,gradeScore
// ,级部得分,gradeScore
...
...
smart-campus/src/main/java/yangtz/cs/liu/wechat/utils/AccessTokenUtil.java
View file @
ec9467a6
...
@@ -41,9 +41,9 @@ public class AccessTokenUtil {
...
@@ -41,9 +41,9 @@ public class AccessTokenUtil {
String
token
=
redisCache
.
getCacheObject
(
ACCESS_TOKEN
);
String
token
=
redisCache
.
getCacheObject
(
ACCESS_TOKEN
);
if
(
StringUtils
.
isEmpty
(
token
))
{
if
(
StringUtils
.
isEmpty
(
token
))
{
try
{
try
{
//
String url = accessTokenUri;
String
url
=
accessTokenUri
;
//测试环境
//测试环境
String
url
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx765a55464b308d13&secret=aa6741b17f05203975b17f0a64458741"
;
//
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx765a55464b308d13&secret=aa6741b17f05203975b17f0a64458741";
// 利用hutool的http工具类请求获取access_token
// 利用hutool的http工具类请求获取access_token
String
result
=
HttpUtil
.
get
(
url
);
String
result
=
HttpUtil
.
get
(
url
);
// 将结果解析为json
// 将结果解析为json
...
...
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