Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
f47d4bde
Commit
f47d4bde
authored
Sep 24, 2021
by
李腾威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公众号前端获取签名
parent
06399247
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
8 deletions
+73
-8
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+1
-1
AlertCalledDto.java
.../yeejoin/amos/boot/module/tzs/api/dto/AlertCalledDto.java
+1
-2
AlertCalled.java
.../yeejoin/amos/boot/module/tzs/api/entity/AlertCalled.java
+4
-0
ElevatorController.java
...os/boot/module/tzs/biz/controller/ElevatorController.java
+1
-1
WechatController.java
...amos/boot/module/tzs/biz/controller/WechatController.java
+66
-4
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
f47d4bde
...
...
@@ -64,7 +64,7 @@ public class ControllerAop {
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
// 不需要添加请求头的接口
String
[]
url
=
new
String
[]{
"/api/user/selectInfo"
,
"/api/user/save/curCompany"
,
"/jcs/command/lookHtmlText"
,
"/jcs/common/duty-person/findByDutyAreaId"
,
"/tzs/wechatBack"
,
"/tzs/wechat-relation/save"
,
"/tzs/alert-called/saveMobile"
};
String
[]
url
=
new
String
[]{
"/api/user/selectInfo"
,
"/api/user/save/curCompany"
,
"/jcs/command/lookHtmlText"
,
"/jcs/common/duty-person/findByDutyAreaId"
,
"/tzs/wechatBack"
,
"/tzs/wechat-relation/save"
,
"/tzs/alert-called/saveMobile"
,
"/tzs/elevator/getElevatorInfo"
};
// 获取请求路径
for
(
String
uri
:
url
)
{
if
(
request
.
getRequestURI
().
indexOf
(
uri
)
!=
-
1
)
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/AlertCalledDto.java
View file @
f47d4bde
...
...
@@ -7,7 +7,6 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
/**
* 警情接警填报记录
...
...
@@ -150,7 +149,7 @@ public class AlertCalledDto extends BaseDto {
private
String
describe
;
@ApiModelProperty
(
value
=
"图片"
)
private
List
<
String
>
images
;
private
String
images
;
@ApiModelProperty
(
value
=
"设备id"
)
private
Long
equipmentId
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/AlertCalled.java
View file @
f47d4bde
...
...
@@ -225,4 +225,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty
(
value
=
"设备id"
)
private
Long
equipmentId
;
@TableField
(
"images"
)
@ApiModelProperty
(
value
=
"图片"
)
private
String
images
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/ElevatorController.java
View file @
f47d4bde
...
...
@@ -294,7 +294,7 @@ public class ElevatorController extends BaseController {
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getElevatorInfo"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
获取电梯使用单位"
,
notes
=
"获取电梯使用单位
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
根据电梯id或电梯救援识别码获取电梯信息"
,
notes
=
"根据电梯id或电梯救援识别码获取电梯信息
"
)
public
ResponseModel
<
ElevatorInfoDto
>
getElevatorInfo
(
Long
sequenceNbr
,
String
rescueCode
)
{
if
(
StringUtils
.
isBlank
(
rescueCode
)
&&
sequenceNbr
==
null
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/WechatController.java
View file @
f47d4bde
...
...
@@ -4,28 +4,27 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IDispatchTaskService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IWechatService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.SmsRecordModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -33,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -49,8 +49,8 @@ import java.io.ByteArrayInputStream;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
...
...
@@ -67,6 +67,8 @@ public class WechatController extends BaseController {
private
final
String
token
=
"yeejoin_2021"
;
private
final
String
WeUrl
=
"https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="
;
@Autowired
RedisUtils
redisUtils
;
...
...
@@ -111,6 +113,41 @@ public class WechatController extends BaseController {
}
/**
* 获取微信签名
* @param timestamp
* @param noncestr
* @param url
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
ANONYMOUS
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getSignature"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取微信签名"
,
notes
=
"获取微信签名"
)
public
String
getSignature
(
@RequestParam
String
timestamp
,
@RequestParam
String
noncestr
,
@RequestParam
String
url
)
{
List
<
String
>
params
=
new
ArrayList
<
String
>();
try
{
if
(!
redisUtils
.
hasKey
(
RedisKey
.
WECHAT_TOKEN
)){
throw
new
BadRequest
(
"token不存在或已失效"
);
}
String
token
=
redisUtils
.
get
(
RedisKey
.
WECHAT_TOKEN
).
toString
();
String
result
=
HttpUtils
.
doGet
(
WeUrl
+
token
+
"&type=jsapi"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
String
ticket
=
jsonObject
.
get
(
"ticket"
).
toString
();
params
.
add
(
"jsapi_ticket="
+
ticket
);
params
.
add
(
noncestr
);
params
.
add
(
timestamp
);
params
.
add
(
url
);
Collections
.
sort
(
params
);
String
tokenStr
=
StringUtils
.
join
(
params
,
"&"
);
tokenStr
=
DigestUtils
.
sha1Hex
(
tokenStr
);
return
tokenStr
;
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
e
.
getMessage
());
}
}
/**
* 获取微信推送的操作通知
* @param xml
* @param resp
...
...
@@ -618,4 +655,29 @@ public class WechatController extends BaseController {
return
ResponseHelper
.
buildResponse
(
dispatchTaskService
.
getTaskListByPhonePager
(
phone
,
taskType
,
currentPage
));
}
/**
* 微信端图片上传
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/uploadImage"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信公众号上传图片"
,
notes
=
"微信公众号上传图片"
)
public
ResponseModel
<
String
>
uploadImage
(
@ApiParam
(
value
=
"图片"
,
required
=
true
)
@RequestParam
MultipartFile
file
)
{
if
(
ValidationUtil
.
isEmpty
(
file
)){
throw
new
BadRequest
(
"参数校验失败."
);
}
FeignClientResult
<
Map
<
String
,
String
>>
date
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
file
);
String
urlString
=
""
;
if
(
date
!=
null
)
{
Map
<
String
,
String
>
map
=
date
.
getResult
();
Iterator
<
String
>
it
=
map
.
keySet
().
iterator
();
while
(
it
.
hasNext
())
{
urlString
=
it
.
next
();
}
}
return
ResponseHelper
.
buildResponse
(
urlString
);
}
}
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