Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
271e9ad1
Commit
271e9ad1
authored
Jul 09, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
61d3eb57
e22a7fed
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
395 additions
and
117 deletions
+395
-117
SystemConfig.java
...ub/wxiaoqi/security/common/util/process/SystemConfig.java
+29
-0
systemconfig.properties
...mon/src/main/resources/properties/systemconfig.properties
+7
-0
AppUserDetailBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
+0
-6
AppUserLoginBiz.java
...om/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
+2
-0
BaseUserMemberExportBiz.java
...b/wxiaoqi/security/admin/biz/BaseUserMemberExportBiz.java
+7
-2
AppUserDetailMapper.java
...ub/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
+2
-0
BaseUserMemberExportMapper.java
...oqi/security/admin/mapper/BaseUserMemberExportMapper.java
+3
-0
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+127
-108
AppUserDetailMapper.xml
...e-admin/src/main/resources/mapper/AppUserDetailMapper.xml
+3
-1
BaseUserMemberExportMapper.xml
.../src/main/resources/mapper/BaseUserMemberExportMapper.xml
+4
-0
pom.xml
xx-universal/xx-universal-server/pom.xml
+5
-0
OrderPayBiz.java
...ain/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
+191
-0
OrderPayController.java
...xfc/platform/universal/controller/OrderPayController.java
+15
-0
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/SystemConfig.java
View file @
271e9ad1
...
...
@@ -61,6 +61,35 @@ public class SystemConfig {
// 存放退款证书目录
public
static
String
APICLIENT_CERT
=
SystemProperty
.
getConfig
(
"APICLIENT_CERT"
);
/**
* 支付宝支付相关配置
*/
public
static
final
String
ALIPAY_APPID
=
SystemProperty
.
getConfig
(
"ALIPAY_APPID"
);
public
static
final
String
ALIPAY_PID
=
SystemProperty
.
getConfig
(
"ALIPAY_PID"
);
public
static
final
String
ALIPAY_PUBLIC_KEY
=
SystemProperty
.
getConfig
(
"ALIPAY_PUBLIC_KEY"
);
public
static
final
String
ALIPAY_ACOUNT
=
SystemProperty
.
getConfig
(
"ALIPAY_ACOUNT"
);
public
static
final
String
ALIPAY_PRIVATE_KEY
=
SystemProperty
.
getConfig
(
"ALIPAY_PRIVATE_KEY"
);
/**
* 交易创建,等待买家付款
*/
public
static
final
String
ALIPAY_WAIT_BUYER_PAY
=
"WAIT_BUYER_PAY"
;
/**
* 未付款交易超时关闭,或支付完成后全额退款
*/
public
static
final
String
ALIPAY_TRADE_CLOSED
=
"TRADE_CLOSED"
;
/**
* 交易支付成功
*/
public
static
final
String
ALIPAY_TRADE_SUCCESS
=
"TRADE_SUCCESS"
;
/**
* 交易结束,不可退款
*/
public
static
final
String
ALIPAY_TRADE_FINISHED
=
"TRADE_FINISHED"
;
public
static
final
String
ALIPAY_PAY_BASE_URL
=
"https://openapi.alipay.com"
;
public
static
final
String
ALIPAY
=
"alipay"
;
public
static
final
String
WXPAY
=
"wxpay"
;
}
ace-common/src/main/resources/properties/systemconfig.properties
View file @
271e9ad1
...
...
@@ -35,3 +35,10 @@ APP_TRADE_TYPE=APP
weixinHost
=
xxtest.upyuns.com
#证书存放目录
APICLIENT_CERT
=
D:
\\
cert
\\
1514583081_20181017_cert.p12
#支付宝配置
ALIPAY_APPID
=
2019070965781964
ALIPAY_PID
=
2088531634846583
ALIPAY_PUBLIC_KEY
=
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj/EMaAD2iJP3I5M0g6pssDDe3RxF5I3ECM/Kz/btM0RiW2g5oRrHSjtGuos9l1QhQAY0SrVqa2eZdPKUB3ZqJdimQiXr3dbiMvG9UCs8vVUcrtCHCBjDllKQLiYzboxE6JLXyfII5tIXbFKiGyiEyXQnffUhQ9uGyT2EGWGecz6PLIjDdbwpxuzF2gIUzV3bPxb+0axejBxJ/3zKnWrsbyq2nvs8XrzrR2CEggNqgqsKzaacCL1yZjXzQRseSnCMtgSxR5W5afbdY0zqbUlLHUrUZ8ycCRC0ECuI9HyTbuqtdWHEZH7vIH44wEQWZPDRhMfMZvzmPUgpTWZLv5BtaQIDAQAB
ALIPAY_ACOUNT
=
xxfc810@163.com
ALIPAY_PRIVATE_KEY
=
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC3bANag6my6pjHWqwnSCffRonvOXE6uQgNNb+V23PV55zfcuC+jIgl9BRrIf4tax5f2itfDmlOdAX6mK8WJ620SHg777Q2KlgNTa25ta3xiEfgkb01SX9VyiaLPpP2TEo5LhhRcT+cUomIufQbVbm/jS8mRQ0qBoofbMfr7n9fBSiVDx/QX07qcJTc/MGCy79H5gUiy2fTOEMhTuNtPkoU3az7jXMQ5U/33ILFAJzPCMNJvQnCYxs/y5loxxHdVqV8FnuCWGEWNViuuBtFRVRNXkrs/x99nF0V5/FHnOZzdM3SWrKCpA/52G5QQrbhZXUhMyCs9stXvH+iVUC1JJ9DAgMBAAECggEAOGRf/5MdOGHCCQCKjyUzBQVV4RPDCS/cFtughH1M9sXXyCc0i8D/FtQc9vcjg2k8lHGqBfaTT8iCEhKhOemHETd6p8rBmCmamrR4JfGCghDJMHT+PATVvlWBViwuJ3o7E6tlVJzB1tjVahDpyQGpMwhAJ77xFiueiZzTNmlEBb02ByCG95vkBV7NQT8yO9/1i3eq/tMoY7FfJP5O4LQ41RmqU9TVaAnTfuE6gs5hJboNGbmSMs2w2M0tldibmWcsQsFFPLwbUz042czSVb9J7lsGJjCtsaBeUiJ15y66W9D3587JJar9p+EyA2LNbolgrrNi2AA9KU5wEW2w8XyoOQKBgQDZamXDQZK3N5E46Hp/79o0Q99jqj9sL/HCYB4+Z8dG/Mgs43HHpgd+gHVeSOgxXS7RxsLyjCsM97ysWk7sbafvqtsnYmPU2MzumykVVpgWO6dpBcwmf2Ygk2i2W77oEqIi2IUmzkvDhw9C8A8/oh+IuoyRouPGRHpykAF+uXKVhwKBgQDX+TfQDDPniSnA9kTlW5I44glRgogA4xJtAYLtEr2fH9Pys+lkOyRqQH5wbJVj27jzJ0lffNyyMxgbZ8KRiH+3qRa8wNazwwXlXmj4DQWZedkULOpgMdU4EbbkTQRU3onEpMAZhAmVvAV1KTozs4RKi+1fFZ9V6ZOtmvapNJuXZQKBgQC7Xb0rQ3SMHwAxGfCQFwVma2O2AX883iisCaemwkrze1+Lh8uDcisdMtlzEsO/3v09XdydqHxlZY6cvgssJ+hFXGoXi+xa/yfFLcR/FixlZK2Gja99MeeyhTcFiRWB7KT8ALrnUXvrmpZlanrJrQ8eBx6jV8ySDmu0FTSkoG8GOwKBgE5toxX7CHJBPhdjlvtPOJdNhiLCaw8fZpaNIPVkg9WgIkCVkuCiFYQ8LW44EDv2E4DBOITje+V+Zne1Q1PEJNUWIzqiMJWQ8bgsg6PoXqswM2N/OBF8pzg4PplDWppTQeZWCah6aVylrbmxIgCaZSUJEUchO/5f1xAJIR+rCgF9AoGBAKJVVbrKPWshQ4cTL6VzanowjpWCRUDR22Oz3nKIdRl1FX+DTXYE4Dwl38iiNHOJptS7VjU553BUZl7HxCmSBWUmtnV78NNnRKrFVUhQhIRYBjMn1W6MD0jlBkky6yXmXkPtlqU6vU19RzGrvv6fDdBf6v4AkD8kWXiH5j4XEiQS
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
View file @
271e9ad1
...
...
@@ -77,10 +77,4 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
View file @
271e9ad1
...
...
@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.common.constant.UserConstant;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
...
...
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
public
class
AppUserLoginBiz
extends
BaseBiz
<
AppUserLoginMapper
,
AppUserLogin
>
{
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Override
public
void
insertSelective
(
AppUserLogin
entity
)
{
String
password
=
new
BCryptPasswordEncoder
(
UserConstant
.
PW_ENCORDER_SALT
).
encode
(
entity
.
getPassword
());
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberExportBiz.java
View file @
271e9ad1
...
...
@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
* @data 2019/7/8 16:19
*/
@Service
@Transactional
@Slf4j
public
class
BaseUserMemberExportBiz
extends
BaseBiz
<
BaseUserMemberExportMapper
,
BaseUserMemberExport
>
{
...
...
@@ -91,7 +92,7 @@ public class BaseUserMemberExportBiz extends BaseBiz<BaseUserMemberExportMapper,
InsertBatch
(
baseUserMemberExports
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
void
InsertBatch
(
List
<
BaseUserMemberExport
>
baseUserMemberExports
)
{
mapper
.
insertList
(
baseUserMemberExports
);
}
...
...
@@ -99,12 +100,12 @@ public class BaseUserMemberExportBiz extends BaseBiz<BaseUserMemberExportMapper,
public
List
<
BaseUserMemberExportDTO
>
findUserMemberExportDataByPhoneAndHashEffective
(
String
phone
){
List
<
BaseUserMemberExportDTO
>
baseUserMemberExportDTOS
=
new
ArrayList
<>();
// BaseUserMemberExport baseUserMemberExport = new BaseUserMemberExport();
Example
example
=
new
Example
(
BaseUserMemberExport
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"username"
,
phone
);
criteria
.
andEqualTo
(
"status"
,
0
);
List
<
BaseUserMemberExport
>
baseUserMemberExports
=
mapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isNotEmpty
(
baseUserMemberExports
)){
BaseUserMemberExportDTO
baseUserMemberExportDTO
;
for
(
BaseUserMemberExport
userMemberExport
:
baseUserMemberExports
)
{
...
...
@@ -115,4 +116,8 @@ public class BaseUserMemberExportBiz extends BaseBiz<BaseUserMemberExportMapper,
}
return
baseUserMemberExportDTOS
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
void
updateUserMemberExportDataToLoseEfficacyByPhone
(
String
phone
){
mapper
.
updateUserMemberExportDataToLoseEfficacyByPhone
(
phone
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
View file @
271e9ad1
...
...
@@ -15,4 +15,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
public
AppUserVo
getUserInfo
(
@Param
(
"userId"
)
Integer
userId
);
List
<
AppUserManageVo
>
selectAppUserManage
(
AppUserManageDTO
appUserManageDTO
);
void
updateUserMemberStatusByUserId
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"status"
)
Integer
status
);
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/BaseUserMemberExportMapper.java
View file @
271e9ad1
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberExport
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.special.InsertListMapper
;
...
...
@@ -12,4 +13,6 @@ import tk.mybatis.mapper.common.special.InsertListMapper;
*/
public
interface
BaseUserMemberExportMapper
extends
Mapper
<
BaseUserMemberExport
>,
InsertListMapper
<
BaseUserMemberExport
>
{
void
updateUserMemberExportDataToLoseEfficacyByPhone
(
@Param
(
"phone"
)
String
phone
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
271e9ad1
...
...
@@ -37,12 +37,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -96,8 +94,6 @@ public class AppPermissionService {
private
BaseUserMemberBiz
baseUserMemberBiz
;
public
AppUserInfo
validate
(
String
username
,
String
password
)
{
AppUserInfo
info
=
new
AppUserInfo
();
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
...
...
@@ -205,7 +201,7 @@ public class AppPermissionService {
* @param headimgurl
* @param mobilecode
*/
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
)
{
// 判断参数和验证码
...
...
@@ -249,9 +245,6 @@ public class AppPermissionService {
appUserLogin
.
setUpdatetime
(
now
);
appUserLoginBiz
.
insertSelective
(
appUserLogin
);
Integer
userid
=
appUserLogin
.
getId
();
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
log
.
error
(
"注册:新增登陆用户信息: "
+
userid
);
// 新增用户详情
AppUserDetail
rsUserDetail
=
new
AppUserDetail
();
...
...
@@ -267,27 +260,29 @@ public class AppPermissionService {
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//自动登录获取优惠卷
//临时会员绑定
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
//自动登录获取优惠卷
authCoupn
(
userid
);
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
)
{
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
)
{
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
//String access_token=map.get("access_token").toString();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
))
{
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
))
{
AppUserLogin
userLogin
=
new
AppUserLogin
();
userLogin
.
setId
(
userid
);
userLogin
.
setImPassword
(
imPassword
);
userLogin
.
setImUserid
(
imUserId
);
userLogin
.
setUsername
(
username
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
}
//data.put("imToken",access_token);
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
...
...
@@ -304,32 +299,32 @@ public class AppPermissionService {
* 自动登录
*/
public
JSONObject
autoLogin
(
Integer
userid
,
String
username
,
String
headimgurl
,
String
nickname
)
{
JSONObject
data
=
new
JSONObject
();
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
if
(
userVo
!=
null
)
{
data
.
put
(
"nickname"
,
nickname
);
data
.
put
(
"headerurl"
,
headimgurl
);
if
(
StringUtils
.
isNotBlank
(
userVo
.
getNickname
()))
{
data
.
put
(
"nickname"
,
userVo
.
getNickname
());
}
if
(
StringUtils
.
isNotBlank
(
userVo
.
getHeadimgurl
()))
{
data
.
put
(
"headerurl"
,
userVo
.
getHeadimgurl
());
}
data
.
put
(
"certificationStatus"
,
userVo
.
getCertificationStatus
());
// 缓存操作
String
token
=
""
;
String
imtoken_
=
""
;
//userRedisTemplate.opsForValue().set("token_" + userid,token, SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
//userRedisTemplate.opsForValue().set("imtoken_" + userid,imtoken_,SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
// 返回结果
// data.put("token", token);
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)?
username:
userVo
.
getUsername
());
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
//更新登录时间 和 ip
String
clientIp
=
getIp
();
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
JSONObject
data
=
new
JSONObject
();
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
if
(
userVo
!=
null
)
{
data
.
put
(
"nickname"
,
nickname
);
data
.
put
(
"headerurl"
,
headimgurl
);
if
(
StringUtils
.
isNotBlank
(
userVo
.
getNickname
()))
{
data
.
put
(
"nickname"
,
userVo
.
getNickname
());
}
if
(
StringUtils
.
isNotBlank
(
userVo
.
getHeadimgurl
()))
{
data
.
put
(
"headerurl"
,
userVo
.
getHeadimgurl
());
}
data
.
put
(
"certificationStatus"
,
userVo
.
getCertificationStatus
());
// 缓存操作
String
token
=
""
;
String
imtoken_
=
""
;
//userRedisTemplate.opsForValue().set("token_" + userid,token, SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
//userRedisTemplate.opsForValue().set("imtoken_" + userid,imtoken_,SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
// 返回结果
// data.put("token", token);
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)
?
username
:
userVo
.
getUsername
());
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
//更新登录时间 和 ip
String
clientIp
=
getIp
();
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
}
return
data
;
...
...
@@ -404,7 +399,7 @@ public class AppPermissionService {
userLogin
.
setUpdatetime
(
now
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
AppUserDetail
userDetail
=
new
AppUserDetail
();
AppUserDetail
userDetail
=
new
AppUserDetail
();
if
(
userVo
==
null
)
{
userDetail
.
setUserid
(
userid
);
userDetail
.
setHeadimgurl
(
headimgurl
);
...
...
@@ -614,9 +609,9 @@ public class AppPermissionService {
//实名认证
@Transactional
public
ObjectRestResponse
upAuthentication
(
Integer
userid
,
String
name
,
String
idNumber
,
Integer
status
)
{
log
.
error
(
"userid===="
+
userid
+
"-----name===="
+
name
+
"----idNumber==="
+
idNumber
+
"---status==="
+
status
);
if
(
userid
==
null
||
userid
==
0
||
(
status
==
1
&&
StringUtils
.
isBlank
(
idNumber
)&&
StringUtils
.
isBlank
(
name
)))
{
public
ObjectRestResponse
upAuthentication
(
Integer
userid
,
String
name
,
String
idNumber
,
Integer
status
)
{
log
.
error
(
"userid===="
+
userid
+
"-----name===="
+
name
+
"----idNumber==="
+
idNumber
+
"---status==="
+
status
);
if
(
userid
==
null
||
userid
==
0
||
(
status
==
1
&&
StringUtils
.
isBlank
(
idNumber
)
&&
StringUtils
.
isBlank
(
name
)))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
try
{
...
...
@@ -628,16 +623,16 @@ public class AppPermissionService {
return
ObjectRestResponse
.
createFailedResultWithObj
(
ResultCode
.
EXIST_CODE
,
"用户已认证"
,
userVo
.
getIdNumber
());
}
if
(
status
==
1
)
{
String
username
=
userVo
.
getUsername
();
String
username
=
userVo
.
getUsername
();
AppUserLogin
user
=
new
AppUserLogin
();
user
.
setId
(
userid
);
user
.
setUsername
(
username
);
user
.
setIdNumber
(
idNumber
);
user
.
setCertificationStatus
(
1
);
appUserLoginBiz
.
updateSelectiveById
(
user
);
if
(
StringUtils
.
isBlank
(
userVo
.
getRealname
()))
{
Integer
id
=
userVo
.
getId
();
userVo
=
new
AppUserVo
();
if
(
StringUtils
.
isBlank
(
userVo
.
getRealname
()))
{
Integer
id
=
userVo
.
getId
();
userVo
=
new
AppUserVo
();
userVo
.
setId
(
id
);
userVo
.
setUserid
(
userid
);
userVo
.
setRealname
(
name
);
...
...
@@ -655,7 +650,7 @@ public class AppPermissionService {
//注册im
public
Map
<
String
,
Object
>
registerIm
(
String
username
,
String
password
,
String
nickname
)
{
log
.
error
(
"------注册registerIm----username====="
+
username
+
"-----password==="
+
password
+
"---nickname==="
+
nickname
);
log
.
error
(
"------注册registerIm----username====="
+
username
+
"-----password==="
+
password
+
"---nickname==="
+
nickname
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"telephone"
,
username
);
map
.
put
(
"password"
,
password
);
...
...
@@ -664,7 +659,7 @@ public class AppPermissionService {
log
.
error
(
"registerIm->response:{}"
,
response
);
if
(
response
.
getStatus
()
==
ResultCode
.
SUCCESS_CODE
)
{
String
result
=
response
.
getMessage
();
log
.
error
(
"------im注册----result======"
+
result
);
log
.
error
(
"------im注册----result======"
+
result
);
if
(
StringUtils
.
isNotBlank
(
result
))
{
JSONObject
object
=
JSONObject
.
parseObject
(
result
);
password
=
object
.
getString
(
"password"
);
...
...
@@ -672,13 +667,13 @@ public class AppPermissionService {
map
.
put
(
"password"
,
password
);
}
JSONObject
data
=
object
.
getJSONObject
(
"data"
);
log
.
error
(
"------im注册----data======"
+
data
);
log
.
error
(
"------im注册----data======"
+
data
);
if
(
data
!=
null
)
{
map
.
put
(
"userId"
,
data
.
getString
(
"userId"
));
// map.put("access_token", data.getString("access_token"));
// map.put("access_token", data.getString("access_token"));
}
else
{
map
.
put
(
"userId"
,
""
);
// map.put("access_token", "");
// map.put("access_token", "");
}
}
}
...
...
@@ -689,7 +684,7 @@ public class AppPermissionService {
//登录im
public
String
loginIm
(
String
username
,
String
password
,
Integer
userId
)
{
log
.
error
(
"------登录loginIm----username====="
+
username
+
"-----password==="
+
password
+
"---userId==="
+
userId
);
log
.
error
(
"------登录loginIm----username====="
+
username
+
"-----password==="
+
password
+
"---userId==="
+
userId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"telephone"
,
username
);
map
.
put
(
"password"
,
password
);
...
...
@@ -699,33 +694,40 @@ public class AppPermissionService {
String
access_token
=
""
;
if
(
response
.
getStatus
()
==
ResultCode
.
SUCCESS_CODE
)
{
String
result
=
response
.
getMessage
();
log
.
error
(
"------im登录----result======"
+
result
);
log
.
error
(
"------im登录----result======"
+
result
);
if
(
StringUtils
.
isNotBlank
(
result
))
{
JSONObject
object
=
JSONObject
.
parseObject
(
result
);
JSONObject
data
=
object
.
getJSONObject
(
"data"
);
log
.
error
(
"------im登录----data======"
+
data
);
log
.
error
(
"------im登录----data======"
+
data
);
if
(
data
!=
null
)
{
access_token
=
data
.
getString
(
"access_token"
);
}
}
}
log
.
error
(
"------im登录----access_token======"
+
access_token
);
log
.
error
(
"------im登录----access_token======"
+
access_token
);
return
access_token
;
}
//自动领取新人优惠卷
public
String
authCoupn
(
Integer
userId
){
return
activityFeign
.
led
(
userId
);
public
String
authCoupn
(
Integer
userId
)
{
try
{
return
activityFeign
.
led
(
userId
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 通过用户id登录*** Unbelievable! ! !
*
* @param uid
* @return
*/
public
JSONObject
appletLoginByUserId
(
Integer
uid
)
{
JSONObject
data
=
autoLogin
(
uid
,
null
,
null
,
null
);
if
(
data
.
getDate
(
"userId"
)
!=
null
)
{
if
(
data
.
getDate
(
"userId"
)
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"用户不存在"
);
...
...
@@ -741,7 +743,7 @@ public class AppPermissionService {
* @param nickname
*/
@Transactional
public
JSONObject
applyRegister
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
Integer
small_id
)
{
public
JSONObject
applyRegister
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
Integer
small_id
)
{
// 判断参数
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
...
...
@@ -763,9 +765,6 @@ public class AppPermissionService {
appUserLogin
.
setUpdatetime
(
now
);
appUserLoginBiz
.
insertSelective
(
appUserLogin
);
Integer
userid
=
appUserLogin
.
getId
();
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
log
.
error
(
"注册:新增登陆用户信息: "
+
userid
);
// 新增用户详情
AppUserDetail
rsUserDetail
=
new
AppUserDetail
();
...
...
@@ -783,29 +782,31 @@ public class AppPermissionService {
setCreateIPInfo
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//上线绑定
relationBiz
.
bindByUserId
(
userid
,
small_id
);
//临时会员绑定
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
//上线绑定
relationBiz
.
bindByUserId
(
userid
,
small_id
);
//发送短信通知用户
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
)
{
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
)
{
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
//String access_token=map.get("access_token").toString();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
))
{
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
))
{
AppUserLogin
userLogin
=
new
AppUserLogin
();
userLogin
.
setId
(
userid
);
userLogin
.
setImPassword
(
imPassword
);
userLogin
.
setImUserid
(
imUserId
);
userLogin
.
setUsername
(
username
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
}
//data.put("imToken",access_token);
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
...
...
@@ -819,47 +820,49 @@ public class AppPermissionService {
}
/**
*通过小程序注册
* 通过小程序注册
*
* @param username
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
small_id
)
{
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
small_id
)
{
try
{
// 是否已存在
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
if
(
null
==
user
)
{
String
password
=
"12345678"
;
data
=
applyRegister
(
username
,
password
,
headimgurl
,
nickname
,
small_id
);
}
else
{
Integer
userid
=
user
.
getId
();
String
password
=
"12345678"
;
data
=
applyRegister
(
username
,
password
,
headimgurl
,
nickname
,
small_id
);
}
else
{
Integer
userid
=
user
.
getId
();
//上线绑定
relationBiz
.
bindByUserId
(
userid
,
small_id
);
relationBiz
.
bindByUserId
(
userid
,
small_id
);
//登录
data
=
appletLoginByUserId
(
userid
);
data
=
appletLoginByUserId
(
userid
);
}
return
data
;
return
data
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXCEPTION_CODE
,
"出现异常"
);
}
}
public
void
insertUserMemberByUserIdAndPhone
(
Integer
userId
,
String
phone
)
throws
Exception
{
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
void
insertUserMemberByUserIdAndPhone
(
Integer
userId
,
String
phone
)
throws
Exception
{
List
<
BaseUserMemberExportDTO
>
memberExportDTOS
=
baseUserMemberExportBiz
.
findUserMemberExportDataByPhoneAndHashEffective
(
phone
);
if
(
CollectionUtils
.
isNotEmpty
(
memberExportDTOS
)){
insertUserMemberByExistUserMemberExportData
(
userId
,
memberExportDTOS
);
if
(
CollectionUtils
.
isNotEmpty
(
memberExportDTOS
))
{
insertUserMemberByExistUserMemberExportData
(
userId
,
memberExportDTOS
);
baseUserMemberExportBiz
.
updateUserMemberExportDataToLoseEfficacyByPhone
(
phone
);
}
}
public
void
insertUserMemberByExistUserMemberExportData
(
Integer
userId
,
List
<
BaseUserMemberExportDTO
>
userMemberExportDTOS
)
throws
Exception
{
private
void
insertUserMemberByExistUserMemberExportData
(
Integer
userId
,
List
<
BaseUserMemberExportDTO
>
userMemberExportDTOS
)
throws
Exception
{
UserMemberDTO
userMemberDTO
;
for
(
BaseUserMemberExportDTO
userMemberExportDTO
:
userMemberExportDTOS
)
{
for
(
BaseUserMemberExportDTO
userMemberExportDTO
:
userMemberExportDTOS
)
{
userMemberDTO
=
new
UserMemberDTO
();
userMemberDTO
.
setUserId
(
userId
);
userMemberDTO
.
setRentFreeDays
(
userMemberExportDTO
.
getRentFreeDays
());
...
...
@@ -867,39 +870,55 @@ public class AppPermissionService {
userMemberDTO
.
setTotalNumber
(
userMemberExportDTO
.
getTotalNumber
());
userMemberDTO
.
setDiscount
(
userMemberExportDTO
.
getDiscount
());
userMemberDTO
.
setIsBind
(
1
);
baseUserMemberBiz
.
updUserMemberByUserId
(
userMemberDTO
);
}
}
baseUserMemberBiz
.
updUserMemberByUserId
(
userMemberDTO
);
}
}
/**
* ip地址 信息解析
*
* @param appUserDetail
*/
public
void
setCreateIPInfo
(
AppUserDetail
appUserDetail
){
public
void
setCreateIPInfo
(
AppUserDetail
appUserDetail
)
{
String
crtHost
=
appUserDetail
.
getCrtHost
();
String
ipAddress
=
restTemplate
.
getForObject
(
String
.
format
(
"%s%s"
,
IPAddress
.
BASE_IP_PARSING_URL
,
crtHost
),
String
.
class
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"解析的地址:【{}】"
,
crtHost
);
}
try
{
analyticalIPByWebSiteAndIPAddress
(
IPAddress
.
BASE_IP_PARSING_URL2
,
crtHost
,
appUserDetail
);
}
catch
(
Exception
e
)
{
try
{
analyticalIPByWebSiteAndIPAddress
(
IPAddress
.
BASE_IP_PARSING_URL1
,
crtHost
,
appUserDetail
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"解析地址失败:【{}】"
,
ex
.
getMessage
());
}
}
}
private
void
analyticalIPByWebSiteAndIPAddress
(
String
url
,
String
crtHost
,
AppUserDetail
appUserDetail
)
{
String
ipAddress
=
restTemplate
.
getForObject
(
String
.
format
(
"%s%s"
,
url
,
crtHost
),
String
.
class
);
String
data
=
JSONObject
.
parseObject
(
ipAddress
).
getString
(
IPAddress
.
BASE_DATA
);
JSONObject
ipJsonObject
=
JSONObject
.
parseObject
(
data
);
String
cityName
=
ipJsonObject
.
getString
(
IPAddress
.
CITY_NAME
);
RegionDTO
regionDTO
=
regionFeign
.
getRegionByCityName
(
cityName
);
if
(
null
!=
regionDTO
)
{
RegionDTO
regionDTO
=
regionFeign
.
getRegionByCityName
(
StringUtils
.
isEmpty
(
cityName
)
?
"东莞"
:
cityName
);
if
(
null
!=
regionDTO
)
{
appUserDetail
.
setProvinceCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getParentId
())));
appUserDetail
.
setCityCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getId
())));
}
}
/**
* @author libin
* @version 1.0.0
* @dec ip 解析返回的地址信息
*/
private
static
class
IPAddress
{
public
static
final
String
BASE_IP_PARSING_URL
=
"http://ip.taobao.com/service/getIpInfo.php?ip="
;
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
PROVINCE_CODE
=
"region_id"
;
public
static
final
String
CITY_CODE
=
"city_id"
;
public
static
final
String
CITY_NAME
=
"city"
;
public
static
final
String
PROVINCE_NAME
=
"region"
;
private
static
class
IPAddress
{
public
static
final
String
BASE_IP_PARSING_URL1
=
"http://ip.taobao.com/service/getIpInfo.php?ip="
;
public
static
final
String
BASE_IP_PARSING_URL2
=
"https://www.mxnzp.com/api/ip/aim_ip?ip="
;
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
CITY_NAME
=
"city"
;
}
}
ace-modules/ace-admin/src/main/resources/mapper/AppUserDetailMapper.xml
View file @
271e9ad1
...
...
@@ -126,5 +126,7 @@
</select>
<update
id=
"updateUserMemberStatusByUserId"
>
update `app_user_detail` set `is_member`={status} where `userid`=#{userId}
</update>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/BaseUserMemberExportMapper.xml
View file @
271e9ad1
...
...
@@ -11,4 +11,8 @@
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"status"
column=
"status"
/>
</resultMap>
<update
id=
"updateUserMemberExportDataToLoseEfficacyByPhone"
>
update `base_user_member_export` set `status`=1 where `username`=#{phone}
</update>
</mapper>
\ No newline at end of file
xx-universal/xx-universal-server/pom.xml
View file @
271e9ad1
...
...
@@ -78,6 +78,11 @@
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<artifactId>
alipay-sdk-java
</artifactId>
<version>
3.7.26.ALL
</version>
</dependency>
<dependency>
<groupId>
antlr
</groupId>
<artifactId>
antlr
</artifactId>
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
View file @
271e9ad1
...
...
@@ -2,6 +2,17 @@ package com.xxfc.platform.universal.biz;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.AlipayConstants
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.domain.AlipayTradeAppPayModel
;
import
com.alipay.api.internal.util.AlipaySignature
;
import
com.alipay.api.request.AlipayFundAuthOrderFreezeRequest
;
import
com.alipay.api.request.AlipayTradeAppPayRequest
;
import
com.alipay.api.response.AlipayFundAuthOrderFreezeResponse
;
import
com.alipay.api.response.AlipayTradeAppPayResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.HTTPSUtils
;
import
com.github.wxiaoqi.security.common.util.OrderUtil
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
...
...
@@ -20,6 +31,11 @@ import com.xxfc.platform.universal.entity.OrderPay;
import
com.xxfc.platform.universal.mapper.OrderPayMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -40,6 +56,9 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
@Autowired
DictionaryBiz
dictionaryBiz
;
@Autowired
HttpServletRequest
request
;
public
JSONObject
preparepay
(
OrderPayVo
orderPayVo
)
{
if
(
null
==
orderPayVo
)
{
log
.
error
(
"-----参数为空-----------"
);
...
...
@@ -131,6 +150,178 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
}
}
/**
* 支付宝回调接口
* @return
*/
public
String
alipayNotify
()
{
//获取支付宝POST过来反馈信息
Map
<
String
,
String
>
params
=
new
HashMap
<>();
Map
requestParams
=
request
.
getParameterMap
();
for
(
Iterator
iter
=
requestParams
.
keySet
().
iterator
();
iter
.
hasNext
();)
{
String
name
=
(
String
)
iter
.
next
();
String
[]
values
=
(
String
[])
requestParams
.
get
(
name
);
String
valueStr
=
""
;
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
valueStr
=
(
i
==
values
.
length
-
1
)
?
valueStr
+
values
[
i
]
:
valueStr
+
values
[
i
]
+
","
;
}
log
.
info
(
valueStr
);
//乱码解决,这段代码在出现乱码时使用。
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
params
.
put
(
name
,
valueStr
);
}
String
msg
=
JSONObject
.
toJSONString
(
params
);
log
.
info
(
"alipay notify message={}"
,
msg
);
// //添加回调记录
// PaymentCallbackLog callbackLog = new PaymentCallbackLog();
// callbackLog.setPayCode(rstradeNo);
// callbackLog.setPayType(SystemConstant.PayType.ALIPAY);
// callbackLog.setOrderCode(rsOrderCode);
// callbackLog.setMessage(msg);
// paymentCallbackLogRepository.save(callbackLog);
//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
//boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type)
try
{
boolean
flag
=
AlipaySignature
.
rsaCheckV1
(
params
,
""
,
AlipayConstants
.
CHARSET_UTF8
,
AlipayConstants
.
SIGN_TYPE_RSA2
);
if
(!
flag
)
{
log
.
info
(
"alipay order rsaCheckV1 fail, result={}"
,
msg
);
return
ObjectRestResponse
.
createDefaultFail
().
getMessage
();
}
String
rsTradeStatus
=
params
.
get
(
"trade_status"
);
if
(!
SystemConfig
.
ALIPAY_TRADE_FINISHED
.
equals
(
rsTradeStatus
)
&&
!
SystemConfig
.
ALIPAY_TRADE_SUCCESS
.
equals
(
rsTradeStatus
))
{
log
.
info
(
"alipay order trade_status has problem, result={}"
,
msg
);
return
ObjectRestResponse
.
createDefaultFail
().
getMessage
();
}
//String rsSellerId = params.get("seller_id");
//
// PaymentRecord paymentRecord = paymentRecordRepository.findOneByOrderCode(rsOrderCode);
// //验证付款信息
// if (paymentRecord == null || !paymentRecord.getAmount().toString().equals(rsAmount)
// || !aliPayConfig.getAppId().equals(rsAppId)) {
// log.info("alipay order notify fail, result={}", msg);
// return Response.FAILURE.getHeader().getMessage();
// }
// //重复回调
// if (paymentRecord.getStatus().intValue() != 1) {
// log.info("alipay order repeat notify, result={}", msg);
// return Response.SUCCESS().getHeader().getMessage();
// }
//
// paymentRecord.setPayCode(rstradeNo);
// paymentRecord.setStatus(2);
// paymentRecordRepository.save(paymentRecord);
// Map<String, Object> sendMap = DataUtils.objectToMap(paymentRecord);
// sendMap.put("amount", new BigDecimal(rsAmount).multiply(new BigDecimal(100)).intValue());
// sendMsgToOrder(JSONObject.toJSONString(sendMap));
return
ObjectRestResponse
.
succ
().
getMessage
();
}
catch
(
AlipayApiException
e
)
{
log
.
error
(
""
,
e
);
}
return
ObjectRestResponse
.
createDefaultFail
().
getMessage
();
}
/**
* 支付宝生成支付信息
* @param orderCode
* @param description
* @param payType
* @param amount
* @return
*/
@SuppressWarnings
(
"rawtypes"
)
private
ObjectRestResponse
generateAliPayment
(
String
orderCode
,
String
description
,
String
payType
,
Integer
amount
)
{
BigDecimal
realAmount
=
new
BigDecimal
(
amount
.
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
String
notifyUrl
=
SystemConfig
.
weixinHost
+
"/service/payment/notify/alipay"
;
//实例化客户端
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
SystemConfig
.
ALIPAY_PAY_BASE_URL
+
"/gateway.do"
,
SystemConfig
.
ALIPAY_APPID
,
SystemConfig
.
ALIPAY_PRIVATE_KEY
,
AlipayConstants
.
FORMAT_JSON
,
AlipayConstants
.
CHARSET_UTF8
,
SystemConfig
.
ALIPAY_PUBLIC_KEY
,
AlipayConstants
.
SIGN_TYPE_RSA2
);
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
AlipayTradeAppPayRequest
request
=
new
AlipayTradeAppPayRequest
();
// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
AlipayTradeAppPayModel
model
=
new
AlipayTradeAppPayModel
();
//model.setBody("我是测试数据");
model
.
setSubject
(
description
);
model
.
setOutTradeNo
(
orderCode
);
model
.
setTimeoutExpress
(
"30m"
);
model
.
setTotalAmount
(
realAmount
.
toString
());
model
.
setProductCode
(
"QUICK_MSECURITY_PAY"
);
request
.
setBizModel
(
model
);
request
.
setNotifyUrl
(
notifyUrl
);
// AlipayFundAuthOrderFreezeRequest request = new AlipayFundAuthOrderFreezeRequest();
// String contentString = "{" +
// "\"auth_code\":\"" + orderCode + "\"," +
// "\"auth_code_type\":\"bar_code\"," +
// "\"out_order_no\":\"8077735255938023\"," +
// "\"out_request_no\":\"8077735255938032\"," +
// "\"order_title\":\"预授权冻结\"," +
// "\"amount\":0.01," +
// "\"payee_logon_id\":\"" + SystemConfig.ALIPAY_ACOUNT + "\"," +
// "\"payee_user_id\":\"" + SystemConfig.ALIPAY_PID + "\"," +
// "\"pay_timeout\":\"2d\"," +
// "\"extra_param\":\"{\\\"secondaryMerchantId\\\":\\\"17320004886\\\"}\"," +
// "\"product_code\":\"PRE_AUTH\"" ;
// log.info("content = {}", contentString);
// request.setBizContent(contentString);
// AlipayFundAuthOrderFreezeResponse response;
// try {
// response = alipayClient.execute(request);
// if(response.isSuccess()){
// System.out.println("调用成功");
// Map<String, Object> rt = new HashMap<>();
// rt.put("payType", payType);
// rt.put("payData", response.getBody());
// return ObjectRestResponse.succ(rt);
// } else {
// System.out.println("调用失败");
// }
// } catch (AlipayApiException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
try
{
//这里和普通的接口调用不同,使用的是sdkExecute
AlipayTradeAppPayResponse
response
=
alipayClient
.
sdkExecute
(
request
);
System
.
out
.
println
(
response
.
getBody
());
//就是orderString 可以直接给客户端请求,无需再做处理。
log
.
info
(
"alipay result={}"
,
response
.
getMsg
());
log
.
info
(
"alipay result={}"
,
response
.
getCode
());
log
.
info
(
"alipay result={}"
,
response
.
getBody
());
Map
<
String
,
Object
>
rt
=
new
HashMap
<>();
rt
.
put
(
"payType"
,
payType
);
rt
.
put
(
"payData"
,
response
.
getBody
());
return
ObjectRestResponse
.
succ
(
rt
);
}
catch
(
AlipayApiException
e
)
{
e
.
printStackTrace
();
}
return
ObjectRestResponse
.
createDefaultFail
();
}
public
ObjectRestResponse
generatePayment
(
String
orderCode
,
String
description
,
String
payType
,
Integer
amount
)
{
ObjectRestResponse
objectRestResponse
=
ObjectRestResponse
.
createDefaultFail
();
switch
(
payType
)
{
case
SystemConfig
.
ALIPAY
:
objectRestResponse
=
generateAliPayment
(
orderCode
,
description
,
payType
,
amount
);
break
;
default
:
log
.
info
(
"不支持的付款类型,payType={}"
,
payType
);
break
;
}
return
objectRestResponse
;
}
public
static
void
main
(
String
[]
args
)
{
String
url
=
"https://xxtest.upyuns.com/api/order/baseOrder/app/unauth/notifyUrl?orderNo=20190603141137010007&tradeNo=20190603141137000002"
;
String
result
=
""
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/OrderPayController.java
View file @
271e9ad1
...
...
@@ -35,6 +35,7 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return
baseBiz
.
preparepay
(
orderPayVo
);
}
/**
* 支付回调
*
...
...
@@ -80,4 +81,18 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
out
.
print
(
"<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[]]></return_msg></xml>"
);
}
@PostMapping
(
value
=
"/app/notify/alipay"
)
@IgnoreUserToken
public
String
alipayNotify
(){
return
baseBiz
.
alipayNotify
();
}
@PostMapping
(
value
=
"/app/generate_payment"
)
public
Object
generatePayment
(
@RequestParam
(
"orderCode"
)
String
orderCode
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
"payType"
)
String
payType
,
@RequestParam
(
"amount"
)
Integer
amount
)
{
Object
resp
=
baseBiz
.
generatePayment
(
orderCode
,
description
,
payType
,
amount
);
return
resp
;
}
}
\ No newline at end of file
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