Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
fd9fb2a6
Commit
fd9fb2a6
authored
Nov 01, 2019
by
dqjdda
Browse files
Merge branch '2.3dev'
parents
7895e547
1839ef8d
Changes
227
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/resources/template/generator/front/api.ftl
View file @
fd9fb2a6
...
...
@@ -22,3 +22,12 @@ export function edit(data) {
data
})
}
export
function download$
{
className
}
(params)
{
return
request
({
url
:
'
api
/$
{
changeClassName
}
/
download
'
,
method
:
'
get
'
,
params
,
responseType
:
'
blob
'
})
}
eladmin-system/src/main/resources/template/generator/front/eForm.ftl
View file @
fd9fb2a6
...
...
@@ -5,7 +5,11 @@
<#list columns as column>
<#if column.changeColumnName != '$
{
pkChangeColName
}
'>
<el-form-item label="<#if column.columnComment != ''>$
{
column
.columnComment
}
<#else>$
{
column
.changeColumnName
}
</#if>" <#if column.columnKey = 'UNI'>prop="$
{
column
.changeColumnName
}
"</#if>>
<#if column.columnType != 'Timestamp'>
<el-input v-model="form.$
{
column
.changeColumnName
}
" style="width: 370px;"/>
<#else >
<el-date-picker v-model="form.$
{
column
.changeColumnName
}
" type="datetime" style="width: 370px;"/>
</#if>
</el-form-item>
</#if>
</#list>
...
...
eladmin-system/src/main/resources/template/generator/front/index.ftl
View file @
fd9fb2a6
...
...
@@ -14,13 +14,23 @@
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['
ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCas
eClassName
}
_CREATE
']"
v-permission="['
admin','$
{
chang
eClassName
}
:add
']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add">新增</el-button>
</div>
<!-- 导出 -->
<div style="display: inline-block;">
<el-button
:loading="downloadLoading"
size="mini"
class="filter-item"
type="warning"
icon="el-icon-download"
@click="download">导出</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd"/>
...
...
@@ -41,11 +51,11 @@
</#if>
</#list>
</#if>
<el-table-column v-if="checkPermission(['
ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT','$
{
upperCaseClassName
}
_DELETE
'])" label="操作" width="150px" align="center">
<el-table-column v-if="checkPermission(['
admin','$
{
changeClassName
}
:edit','$
{
changeClassName
}
:del
'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['
ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCas
eClassName
}
_EDIT
']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
<el-button v-permission="['
admin','$
{
chang
eClassName
}
:edit
']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
<el-popover
v-permission="['
ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCas
eClassName
}
_DELETE
']"
v-permission="['
admin','$
{
chang
eClassName
}
:del
']"
:ref="scope.row.$
{
pkChangeColName
}
"
placement="top"
width="180">
...
...
@@ -73,9 +83,9 @@
<
script
>
import
checkPermission from '@/utils/permission'
import
initData from '@/mixins/initData'
import
{
del
}
from '@/api/$
{
changeClassName
}
'
import
{
del
,
download
$
{
className
}
}
from '@/api/$
{
changeClassName
}
'
<#
if
hasTimestamp>
import
{
parseTime
}
from '@/utils/index'
import
{
parseTime
,
downloadFile
}
from '@/utils/index'
</#
if
>
import
eForm from './form'
export
default
{
...
...
@@ -150,6 +160,17 @@ export default {
</#
if
>
}
_
this
.dialog
=
true
},
//
导出
download
()
{
this
.beforeInit
()
this
.downloadLoading
=
true
download
$
{
className
}(
this
.params
)
.then
(
result
=>
{
downloadFile
(
result
,
'$
{
className
}
列表'
,
'
xlsx
'
)
this
.downloadLoading
=
false
})
.catch
(()
=>
{
this
.downloadLoading
=
false
})
}
}
}
...
...
eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java
View file @
fd9fb2a6
...
...
@@ -11,7 +11,7 @@ public class EladminSystemApplicationTests {
@Test
public
void
contextLoads
()
{
}
}
}
eladmin-tools/pom.xml
View file @
fd9fb2a6
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
eladmin
</artifactId>
<groupId>
me.zhengjie
</groupId>
<version>
2.
2
</version>
<version>
2.
3
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
@@ -23,7 +23,7 @@
<dependency>
<groupId>
me.zhengjie
</groupId>
<artifactId>
eladmin-logging
</artifactId>
<version>
2.
2
</version>
<version>
2.
3
</version>
</dependency>
<!--邮件依赖-->
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/AlipayConfig.java
View file @
fd9fb2a6
...
...
@@ -18,66 +18,46 @@ public class AlipayConfig implements Serializable {
@Id
private
Long
id
;
/**
* 应用ID,APPID,收款账号既是APPID对应支付宝账号
*/
// 应用ID,APPID,收款账号既是APPID对应支付宝账号
@NotBlank
@Column
(
name
=
"app_id"
)
private
String
appID
;
/**
* 商户私钥,您的PKCS8格式RSA2私钥
*/
// 商户私钥,您的PKCS8格式RSA2私钥
@NotBlank
@Column
(
name
=
"private_key"
,
columnDefinition
=
"text"
)
private
String
privateKey
;
/**
* 支付宝公钥
*/
// 支付宝公钥
@NotBlank
@Column
(
name
=
"public_key"
,
columnDefinition
=
"text"
)
private
String
publicKey
;
/**
* 签名方式,固定格式
*/
// 签名方式,固定格式
@Column
(
name
=
"sign_type"
)
private
String
signType
=
"RSA2"
;
/**
* 支付宝开放安全地址,一般不会变
*/
// 支付宝开放安全地址,一般不会变
@Column
(
name
=
"gateway_url"
)
private
String
gatewayUrl
=
"https://openapi.alipaydev.com/gateway.do"
;
/**
* 编码,固定格式
*/
// 编码,固定格式
private
String
charset
=
"utf-8"
;
/**
* 异步通知地址
*/
// 异步通知地址
@NotBlank
@Column
(
name
=
"notify_url"
)
private
String
notifyUrl
;
/**
* 订单完成后返回的页面
*/
// 订单完成后返回的页面
@NotBlank
@Column
(
name
=
"return_url"
)
private
String
returnUrl
;
/**
* 类型,固定格式
*/
// 类型,固定格式
private
String
format
=
"JSON"
;
/**
* 商户号
*/
// 商户号
@NotBlank
@Column
(
name
=
"sys_service_provider_id"
)
private
String
sysServiceProviderId
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/EmailConfig.java
View file @
fd9fb2a6
...
...
@@ -19,30 +19,22 @@ public class EmailConfig implements Serializable {
@Id
private
Long
id
;
/**
*邮件服务器SMTP地址
*/
// 邮件服务器SMTP地址
@NotBlank
private
String
host
;
/**
* 邮件服务器SMTP端口
*/
// 邮件服务器SMTP端口
@NotBlank
private
String
port
;
/**
* 发件者用户名,默认为发件人邮箱前缀
*/
// 发件者用户名,默认为发件人邮箱前缀
@NotBlank
private
String
user
;
@NotBlank
private
String
pass
;
/**
* 收件人
*/
// 收件人
@NotBlank
@Column
(
name
=
"from_user"
)
private
String
fromUser
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/LocalStorage.java
View file @
fd9fb2a6
package
me.zhengjie.domain
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.*
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
lombok.NoArgsConstructor
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author Zheng Jie
* @date 2019-09-05
*/
@Getter
@Setter
@Entity
@Data
@Table
(
name
=
"local_storage"
)
@AllArgsConstructor
@NoArgsConstructor
public
class
LocalStorage
implements
Serializable
{
public
class
LocalStorage
implements
Serializable
{
// ID
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
...
...
@@ -57,16 +54,10 @@ public class LocalStorage implements Serializable {
@Column
(
name
=
"operate"
)
private
String
operate
;
// 创建日期
@Column
(
name
=
"create_time"
)
@CreationTimestamp
private
Timestamp
createTime
;
// 修改日期
@Column
(
name
=
"update_time"
)
@UpdateTimestamp
private
Timestamp
updateTime
;
public
LocalStorage
(
String
realName
,
String
name
,
String
suffix
,
String
path
,
String
type
,
String
size
,
String
operate
)
{
this
.
realName
=
realName
;
this
.
name
=
name
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/Picture.java
View file @
fd9fb2a6
...
...
@@ -32,9 +32,6 @@ public class Picture implements Serializable {
private
String
width
;
/**
* delete URl
*/
@Column
(
name
=
"delete_url"
)
private
String
delete
;
...
...
@@ -44,6 +41,9 @@ public class Picture implements Serializable {
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
// 用于检测文件是否重复
private
String
md5Code
;
@Override
public
String
toString
()
{
return
"Picture{"
+
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java
View file @
fd9fb2a6
...
...
@@ -18,23 +18,17 @@ public class QiniuConfig implements Serializable {
@Id
private
Long
id
;
/**
* 一个账号最多拥有两对密钥(Access/Secret Key)
*/
// 一个账号最多拥有两对密钥(Access/Secret Key)
@NotBlank
@Column
(
name
=
"access_key"
,
columnDefinition
=
"text"
)
private
String
accessKey
;
/**
* 一个账号最多拥有两对密钥(Access/Secret Key)
*/
// 一个账号最多拥有两对密钥(Access/Secret Key)
@NotBlank
@Column
(
name
=
"secret_key"
,
columnDefinition
=
"text"
)
private
String
secretKey
;
/**
* 存储空间名称作为唯一的 Bucket 识别符
*/
// 存储空间名称作为唯一的 Bucket 识别符
@NotBlank
private
String
bucket
;
...
...
@@ -49,14 +43,10 @@ public class QiniuConfig implements Serializable {
@NotBlank
private
String
zone
;
/**
* 外链域名,可自定义,需在七牛云绑定
*/
// 外链域名,可自定义,需在七牛云绑定
@NotBlank
private
String
host
;
/**
* 空间类型:公开/私有
*/
// 空间类型:公开/私有
private
String
type
=
"公开"
;
}
eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java
View file @
fd9fb2a6
...
...
@@ -21,37 +21,25 @@ public class QiniuContent implements Serializable {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
/**
* 文件名,如qiniu.jpg
*/
@Column
(
name
=
"name"
,
unique
=
false
)
// 文件名
@Column
(
name
=
"name"
)
private
String
key
;
/**
* 空间名
*/
// 空间名
private
String
bucket
;
/**
* 大小
*/
// 大小
private
String
size
;
/**
* 文件地址
*/
// 文件地址
private
String
url
;
private
String
suffix
;
/**
* 空间类型:公开/私有
*/
// 空间类型:公开/私有
private
String
type
=
"公开"
;
/**
* 更新时间
*/
// 更新时间
@UpdateTimestamp
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/VerificationCode.java
View file @
fd9fb2a6
...
...
@@ -7,6 +7,7 @@ import org.hibernate.annotations.CreationTimestamp;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
...
...
@@ -18,7 +19,7 @@ import java.sql.Timestamp;
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"verification_code"
)
public
class
VerificationCode
{
public
class
VerificationCode
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
...
@@ -26,32 +27,21 @@ public class VerificationCode {
private
String
code
;
/**
* 使用场景,自己定义
*/
// 使用场景,自己定义
private
String
scenes
;
/**
* true 为有效,false 为无效,验证时状态+时间+具体的邮箱或者手机号
*/
// true 为有效,false 为无效,验证时状态+时间+具体的邮箱或者手机号
private
Boolean
status
=
true
;
/**
* 类型 :phone 和 email
*/
// 类型 :phone 和 email
@NotBlank
private
String
type
;
/**
* 具体的phone与email
*/
// 具体的phone与email
@NotBlank
private
String
value
;
/**
* 创建日期
*/
// 创建日期
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/vo/EmailVo.java
View file @
fd9fb2a6
...
...
@@ -18,9 +18,7 @@ import java.util.List;
@NoArgsConstructor
public
class
EmailVo
{
/**
* 收件人,支持多个收件人,用逗号分隔
*/
// 收件人,支持多个收件人,用逗号分隔
@NotEmpty
private
List
<
String
>
tos
;
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/vo/TradeVo.java
View file @
fd9fb2a6
...
...
@@ -15,51 +15,35 @@ import java.sql.Timestamp;
@Data
public
class
TradeVo
{
/**
* (必填)商品描述
*/
// (必填)商品描述
@NotBlank
private
String
body
;
/**
* (必填)商品名称
*/
// (必填)商品名称
@NotBlank
private
String
subject
;
/**
* (必填)商户订单号,应该由后台生成
*/
// (必填)商户订单号,应该由后台生成
@ApiModelProperty
(
hidden
=
true
)
private
String
outTradeNo
;
/**
* (必填)第三方订单号
*/
// (必填)第三方订单号
@ApiModelProperty
(
hidden
=
true
)
private
String
tradeNo
;
/**
* (必填)价格
*/
// (必填)价格
@NotBlank
private
String
totalAmount
;
/**
* 订单状态,已支付,未支付,作废
*/
// 订单状态,已支付,未支付,作废
@ApiModelProperty
(
hidden
=
true
)
private
String
state
;
/**
* 创建时间,存入数据库时需要
*/
// 创建时间,存入数据库时需要
@ApiModelProperty
(
hidden
=
true
)
private
Timestamp
createTime
;
/**
* 作废时间,存入数据库时需要
*/
// 作废时间,存入数据库时需要
@ApiModelProperty
(
hidden
=
true
)
private
Date
cancelTime
;
}
eladmin-tools/src/main/java/me/zhengjie/repository/LocalStorageRepository.java
View file @
fd9fb2a6
...
...
@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author Zheng Jie
* @date 2019-09-05
*/
public
interface
LocalStorageRepository
extends
JpaRepository
<
LocalStorage
,
Long
>,
JpaSpecificationExecutor
{
public
interface
LocalStorageRepository
extends
JpaRepository
<
LocalStorage
,
Long
>,
JpaSpecificationExecutor
<
LocalStorage
>
{
}
\ No newline at end of file
eladmin-tools/src/main/java/me/zhengjie/repository/PictureRepository.java
View file @
fd9fb2a6
...
...
@@ -8,5 +8,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author Zheng Jie
* @date 2018-12-27
*/
public
interface
PictureRepository
extends
JpaRepository
<
Picture
,
Long
>,
JpaSpecificationExecutor
{
public
interface
PictureRepository
extends
JpaRepository
<
Picture
,
Long
>,
JpaSpecificationExecutor
<
Picture
>
{
Picture
findByMd5Code
(
String
code
);
}
eladmin-tools/src/main/java/me/zhengjie/repository/QiNiuConfigRepository.java
View file @
fd9fb2a6
...
...
@@ -12,6 +12,6 @@ import org.springframework.data.jpa.repository.Query;
public
interface
QiNiuConfigRepository
extends
JpaRepository
<
QiniuConfig
,
Long
>
{
@Modifying
@Query
(
value
=
"update
q
iniu
_content
set type = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"update
Q
iniu
Config
set type = ?1"
)
void
update
(
String
type
);
}
eladmin-tools/src/main/java/me/zhengjie/repository/QiniuContentRepository.java
View file @
fd9fb2a6
...
...
@@ -8,12 +8,12 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author Zheng Jie
* @date 2018-12-31
*/
public
interface
QiniuContentRepository
extends
JpaRepository
<
QiniuContent
,
Long
>,
JpaSpecificationExecutor
{
public
interface
QiniuContentRepository
extends
JpaRepository
<
QiniuContent
,
Long
>,
JpaSpecificationExecutor
<
QiniuContent
>
{
/**
* 根据key查询
* @param key
* @return
* @param key
文件名
* @return
QiniuContent
*/
QiniuContent
findByKey
(
String
key
);
}
eladmin-tools/src/main/java/me/zhengjie/repository/VerificationCodeRepository.java
View file @
fd9fb2a6
...
...
@@ -12,9 +12,9 @@ public interface VerificationCodeRepository extends JpaRepository<VerificationCo
/**
* 获取有效的验证码
* @param scenes 业务场景,如重置密码,重置邮箱等等
* @param type
* @param value
* @return
* @param type
类型
* @param value
值
* @return
VerificationCode
*/
VerificationCode
findByScenesAndTypeAndValueAndStatusIsTrue
(
String
scenes
,
String
type
,
String
value
);
}
eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java
View file @
fd9fb2a6
package
me.zhengjie.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.annotation.AnonymousAccess
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.domain.AlipayConfig
;
import
me.zhengjie.domain.vo.TradeVo
;
import
me.zhengjie.service.AlipayService
;
import
me.zhengjie.utils.AliPayStatusEnum
;
import
me.zhengjie.utils.AlipayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Map
;
/**
...
...
@@ -24,22 +26,27 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping
(
"/api"
)
@RequestMapping
(
"/api/aliPay"
)
@Api
(
tags
=
"工具:支付宝管理"
)
public
class
AliPayController
{
@Autowired
AlipayUtils
alipayUtils
;
private
final
AlipayUtils
alipayUtils
;
@Autowired
private
AlipayService
alipayService
;
private
final
AlipayService
alipayService
;
@GetMapping
(
value
=
"/aliPay"
)
public
AliPayController
(
AlipayUtils
alipayUtils
,
AlipayService
alipayService
)
{
this
.
alipayUtils
=
alipayUtils
;
this
.
alipayService
=
alipayService
;
}
@GetMapping
public
ResponseEntity
<
AlipayConfig
>
get
(){
return
new
ResponseEntity
<>(
alipayService
.
find
(),
HttpStatus
.
OK
);
}
@Log
(
"配置支付宝"
)
@PutMapping
(
value
=
"/aliPay"
)
@ApiOperation
(
"配置支付宝"
)
@PutMapping
public
ResponseEntity
payConfig
(
@Validated
@RequestBody
AlipayConfig
alipayConfig
){
alipayConfig
.
setId
(
1L
);
alipayService
.
update
(
alipayConfig
);
...
...
@@ -47,8 +54,8 @@ public class AliPayController {
}
@Log
(
"支付宝PC网页支付"
)
@ApiOperation
(
value
=
"PC网页支付"
)
@PostMapping
(
value
=
"/
aliPay/
toPayAsPC"
)
@ApiOperation
(
"PC网页支付"
)
@PostMapping
(
value
=
"/toPayAsPC"
)
public
ResponseEntity
<
String
>
toPayAsPC
(
@Validated@RequestBody
TradeVo
trade
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
...
...
@@ -57,8 +64,8 @@ public class AliPayController {
}
@Log
(
"支付宝手机网页支付"
)
@ApiOperation
(
value
=
"手机网页支付"
)
@PostMapping
(
value
=
"/
aliPay/
toPayAsWeb"
)
@ApiOperation
(
"手机网页支付"
)
@PostMapping
(
value
=
"/toPayAsWeb"
)
public
ResponseEntity
<
String
>
toPayAsWeb
(
@Validated
@RequestBody
TradeVo
trade
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
...
...
@@ -67,54 +74,48 @@ public class AliPayController {
}
@ApiIgnore
@GetMapping
(
"/aliPay/return"
)
@ApiOperation
(
value
=
"支付之后跳转的链接"
)
public
ResponseEntity
<
String
>
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
@GetMapping
(
"/return"
)
@AnonymousAccess
@ApiOperation
(
"支付之后跳转的链接"
)
public
ResponseEntity
<
String
>
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
){
AlipayConfig
alipay
=
alipayService
.
find
();
response
.
setContentType
(
"text/html;charset="
+
alipay
.
getCharset
());
//内容验签,防止黑客篡改参数
if
(
alipayUtils
.
rsaCheck
(
request
,
alipay
)){
//商户订单号
String
outTradeNo
=
new
String
(
request
.
getParameter
(
"out_trade_no"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
outTradeNo
=
new
String
(
request
.
getParameter
(
"out_trade_no"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
//支付宝交易号
String
tradeNo
=
new
String
(
request
.
getParameter
(
"trade_no"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
tradeNo
=
new
String
(
request
.
getParameter
(
"trade_no"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
System
.
out
.
println
(
"商户订单号"
+
outTradeNo
+
" "
+
"第三方交易号"
+
tradeNo
);
/**
* 根据业务需要返回数据,这里统一返回OK
*/
// 根据业务需要返回数据,这里统一返回OK
return
new
ResponseEntity
<>(
"payment successful"
,
HttpStatus
.
OK
);
}
else
{
/**
* 根据业务需要返回数据
*/
// 根据业务需要返回数据
return
new
ResponseEntity
<>(
HttpStatus
.
BAD_REQUEST
);
}
}
@ApiIgnore
@RequestMapping
(
"/aliPay/notify"
)
@ApiOperation
(
value
=
"支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理"
)
public
ResponseEntity
notify
(
HttpServletRequest
request
)
throws
Exception
{
@RequestMapping
(
"/notify"
)
@AnonymousAccess
@ApiOperation
(
"支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理"
)
public
ResponseEntity
notify
(
HttpServletRequest
request
){
AlipayConfig
alipay
=
alipayService
.
find
();
Map
<
String
,
String
[]>
parameterMap
=
request
.
getParameterMap
();
StringBuilder
notifyBuild
=
new
StringBuilder
(
"/****************************** pay notify ******************************/\n"
);
parameterMap
.
forEach
((
key
,
value
)
->
notifyBuild
.
append
(
key
+
"="
+
value
[
0
]
+
"\n"
)
);
//内容验签,防止黑客篡改参数
if
(
alipayUtils
.
rsaCheck
(
request
,
alipay
))
{
//交易状态
String
tradeStatus
=
new
String
(
request
.
getParameter
(
"trade_status"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
tradeStatus
=
new
String
(
request
.
getParameter
(
"trade_status"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
// 商户订单号
String
outTradeNo
=
new
String
(
request
.
getParameter
(
"out_trade_no"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
outTradeNo
=
new
String
(
request
.
getParameter
(
"out_trade_no"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
//支付宝交易号
String
tradeNo
=
new
String
(
request
.
getParameter
(
"trade_no"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
tradeNo
=
new
String
(
request
.
getParameter
(
"trade_no"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
//付款金额
String
totalAmount
=
new
String
(
request
.
getParameter
(
"total_amount"
).
getBytes
(
"
ISO
-
8859
-1"
),
"UTF-8"
);
String
totalAmount
=
new
String
(
request
.
getParameter
(
"total_amount"
).
getBytes
(
StandardCharsets
.
ISO
_
8859
_1
),
StandardCharsets
.
UTF_8
);
//验证
if
(
tradeStatus
.
equals
(
AliPayStatusEnum
.
SUCCESS
.
getValue
())||
tradeStatus
.
equals
(
AliPayStatusEnum
.
FINISHED
.
getValue
())){
/**
* 验证通过后应该根据业务需要处理订单
*/
// 验证通过后应该根据业务需要处理订单
}
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
...
...
Prev
1
…
6
7
8
9
10
11
12
Next
Write
Preview
Supports
Markdown
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