Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payment
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
曲欣亮
payment
Commits
c5abb58b
Commit
c5abb58b
authored
Oct 16, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
e3d8a118
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
294 additions
and
46 deletions
+294
-46
WxApiController.java
...in/java/com/egolm/payment/controller/WxApiController.java
+12
-11
WxMiniApiController.java
...ava/com/egolm/payment/controller/WxMiniApiController.java
+5
-9
TSystemCtrl.java
src/main/java/com/egolm/payment/pojo/TSystemCtrl.java
+251
-0
SystemCtrlService.java
...ain/java/com/egolm/payment/service/SystemCtrlService.java
+2
-2
WxChatService.java
src/main/java/com/egolm/payment/service/WxChatService.java
+9
-7
SystemCtrlServiceImpl.java
...com/egolm/payment/service/impl/SystemCtrlServiceImpl.java
+3
-5
WeChatServiceImpl.java
...ava/com/egolm/payment/service/impl/WeChatServiceImpl.java
+12
-12
No files found.
src/main/java/com/egolm/payment/controller/WxApiController.java
View file @
c5abb58b
...
...
@@ -20,6 +20,7 @@ import com.egolm.common.DateUtil;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.payment.pojo.TSystemCtrl
;
import
com.egolm.payment.service.WxChatService
;
import
com.egolm.payment.util.PayContstrant
;
import
com.egolm.payment.util.WxSignUtil
;
...
...
@@ -67,13 +68,13 @@ public class WxApiController {
SortedMap
<
Object
,
Object
>
params
=
new
TreeMap
<
Object
,
Object
>();
String
appid
=
""
;
String
md5Key
=
""
;
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
appid
=
systemCtrlMap
.
get
(
"sValue1"
)+
""
;
String
mch_id
=
systemCtrlMap
.
get
(
"sValue3"
)+
""
;
String
notify_url
=
systemCtrlMap
.
get
(
"sValue4"
)+
""
;
TSystemCtrl
tSystemCtrl
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
terminal
,
langID
);
if
(
tSystemCtrl
!=
null
)
{
appid
=
tSystemCtrl
.
getsValue1
()
;
String
mch_id
=
tSystemCtrl
.
getsValue3
()
;
String
notify_url
=
tSystemCtrl
.
getsValue4
()
;
md5Key
=
systemCtrlMap
.
get
(
"sValue5"
)+
""
;
md5Key
=
tSystemCtrl
.
getsValue5
()
;
params
.
put
(
"appid"
,
appid
);
params
.
put
(
"mch_id"
,
mch_id
);
params
.
put
(
"notify_url"
,
notify_url
);
...
...
@@ -181,11 +182,11 @@ public class WxApiController {
String
appid
=
""
;
String
mch_id
=
""
;
String
md5Key
=
""
;
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
appid
=
systemCtrlMap
.
get
(
"sValue1"
)+
""
;
mch_id
=
systemCtrlMap
.
get
(
"sValue3"
)+
""
;
md5Key
=
systemCtrlMap
.
get
(
"sValue5"
)+
""
;
TSystemCtrl
tSystemCtrl
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
terminal
,
langID
);
if
(
tSystemCtrl
!=
null
)
{
appid
=
tSystemCtrl
.
getsValue1
()
;
mch_id
=
tSystemCtrl
.
getsValue3
()
;
md5Key
=
tSystemCtrl
.
getsValue5
()
;
if
(!
StringUtil
.
isNotEmpty
(
appid
,
mch_id
,
md5Key
))
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"支付失败"
).
set
(
"errorMsg"
,
"数据字典参数配置不完整"
).
toJson
();
...
...
src/main/java/com/egolm/payment/controller/WxMiniApiController.java
View file @
c5abb58b
...
...
@@ -2,8 +2,6 @@ package com.egolm.payment.controller;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -16,13 +14,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.
common.web.ServletUti
l
;
import
com.egolm.
payment.pojo.TSystemCtr
l
;
import
com.egolm.payment.service.WxChatService
;
import
com.egolm.payment.util.PayContstrant
;
import
com.egolm.payment.util.WxSignUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -66,10 +62,10 @@ public class WxMiniApiController {
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
params
.
put
(
"appid"
,
systemCtrlMap
.
get
(
"sValue1"
)+
""
);
params
.
put
(
"secret"
,
systemCtrlMap
.
get
(
"sValue2"
)+
""
);
TSystemCtrl
tSystemCtrl
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
terminal
,
langID
);
if
(
tSystemCtrl
!=
null
)
{
params
.
put
(
"appid"
,
tSystemCtrl
.
getsValue1
()
);
params
.
put
(
"secret"
,
tSystemCtrl
.
getsValue2
()
);
}
else
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"openId获取失败"
).
set
(
"errorMsg"
,
"数据字典参数未配置"
).
toJson
();
}
...
...
src/main/java/com/egolm/payment/pojo/TSystemCtrl.java
0 → 100644
View file @
c5abb58b
package
com
.
egolm
.
payment
.
pojo
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.util.Date
;
/**
* @author 曲欣亮
* @since 2018-10-15
* @version v-1.0
*/
@Entity
(
name
=
"tSystemCtrl"
)
public
class
TSystemCtrl
implements
java
.
io
.
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
sCreateUser
;
private
String
sChangeUser
;
private
String
sSysTypeID
;
private
Date
dConfirmDate
;
private
String
sValue2
;
private
String
sValue3
;
@Id
private
String
sCode
;
private
String
sValue5
;
private
Date
dCreateDate
;
private
String
sSysType
;
private
Date
dLastUpdateTime
;
private
String
sValue1
;
private
Date
dChangeDate
;
private
String
sDesc
;
private
String
sValue4
;
private
String
sConfirmUser
;
private
String
sMemo
;
private
Integer
nTag
;
/**
* 无参数构造方法
*/
public
TSystemCtrl
()
{
super
();
}
/**
* 全参数构造方法
* @param sCreateUser
* @param sChangeUser
* @param sSysTypeID
* @param dConfirmDate
* @param sValue2
* @param sValue3
* @param sCode
* @param sValue5
* @param dCreateDate
* @param sSysType
* @param dLastUpdateTime
* @param sValue1
* @param dChangeDate
* @param sDesc
* @param sValue4
* @param sConfirmUser
* @param sMemo
* @param nTag
*/
public
TSystemCtrl
(
String
sCreateUser
,
String
sChangeUser
,
String
sSysTypeID
,
Date
dConfirmDate
,
String
sValue2
,
String
sValue3
,
String
sCode
,
String
sValue5
,
Date
dCreateDate
,
String
sSysType
,
Date
dLastUpdateTime
,
String
sValue1
,
Date
dChangeDate
,
String
sDesc
,
String
sValue4
,
String
sConfirmUser
,
String
sMemo
,
Integer
nTag
)
{
this
.
sCreateUser
=
sCreateUser
;
this
.
sChangeUser
=
sChangeUser
;
this
.
sSysTypeID
=
sSysTypeID
;
this
.
dConfirmDate
=
dConfirmDate
;
this
.
sValue2
=
sValue2
;
this
.
sValue3
=
sValue3
;
this
.
sCode
=
sCode
;
this
.
sValue5
=
sValue5
;
this
.
dCreateDate
=
dCreateDate
;
this
.
sSysType
=
sSysType
;
this
.
dLastUpdateTime
=
dLastUpdateTime
;
this
.
sValue1
=
sValue1
;
this
.
dChangeDate
=
dChangeDate
;
this
.
sDesc
=
sDesc
;
this
.
sValue4
=
sValue4
;
this
.
sConfirmUser
=
sConfirmUser
;
this
.
sMemo
=
sMemo
;
this
.
nTag
=
nTag
;
}
public
void
setsCreateUser
(
String
sCreateUser
)
{
this
.
sCreateUser
=
sCreateUser
;
}
public
String
getsCreateUser
()
{
return
sCreateUser
;
}
public
void
setsChangeUser
(
String
sChangeUser
)
{
this
.
sChangeUser
=
sChangeUser
;
}
public
String
getsChangeUser
()
{
return
sChangeUser
;
}
public
void
setsSysTypeID
(
String
sSysTypeID
)
{
this
.
sSysTypeID
=
sSysTypeID
;
}
public
String
getsSysTypeID
()
{
return
sSysTypeID
;
}
public
void
setdConfirmDate
(
Date
dConfirmDate
)
{
this
.
dConfirmDate
=
dConfirmDate
;
}
public
Date
getdConfirmDate
()
{
return
dConfirmDate
;
}
public
void
setsValue2
(
String
sValue2
)
{
this
.
sValue2
=
sValue2
;
}
public
String
getsValue2
()
{
return
sValue2
;
}
public
void
setsValue3
(
String
sValue3
)
{
this
.
sValue3
=
sValue3
;
}
public
String
getsValue3
()
{
return
sValue3
;
}
public
void
setsCode
(
String
sCode
)
{
this
.
sCode
=
sCode
;
}
public
String
getsCode
()
{
return
sCode
;
}
public
void
setsValue5
(
String
sValue5
)
{
this
.
sValue5
=
sValue5
;
}
public
String
getsValue5
()
{
return
sValue5
;
}
public
void
setdCreateDate
(
Date
dCreateDate
)
{
this
.
dCreateDate
=
dCreateDate
;
}
public
Date
getdCreateDate
()
{
return
dCreateDate
;
}
public
void
setsSysType
(
String
sSysType
)
{
this
.
sSysType
=
sSysType
;
}
public
String
getsSysType
()
{
return
sSysType
;
}
public
void
setdLastUpdateTime
(
Date
dLastUpdateTime
)
{
this
.
dLastUpdateTime
=
dLastUpdateTime
;
}
public
Date
getdLastUpdateTime
()
{
return
dLastUpdateTime
;
}
public
void
setsValue1
(
String
sValue1
)
{
this
.
sValue1
=
sValue1
;
}
public
String
getsValue1
()
{
return
sValue1
;
}
public
void
setdChangeDate
(
Date
dChangeDate
)
{
this
.
dChangeDate
=
dChangeDate
;
}
public
Date
getdChangeDate
()
{
return
dChangeDate
;
}
public
void
setsDesc
(
String
sDesc
)
{
this
.
sDesc
=
sDesc
;
}
public
String
getsDesc
()
{
return
sDesc
;
}
public
void
setsValue4
(
String
sValue4
)
{
this
.
sValue4
=
sValue4
;
}
public
String
getsValue4
()
{
return
sValue4
;
}
public
void
setsConfirmUser
(
String
sConfirmUser
)
{
this
.
sConfirmUser
=
sConfirmUser
;
}
public
String
getsConfirmUser
()
{
return
sConfirmUser
;
}
public
void
setsMemo
(
String
sMemo
)
{
this
.
sMemo
=
sMemo
;
}
public
String
getsMemo
()
{
return
sMemo
;
}
public
void
setnTag
(
Integer
nTag
)
{
this
.
nTag
=
nTag
;
}
public
Integer
getnTag
()
{
return
nTag
;
}
}
src/main/java/com/egolm/payment/service/SystemCtrlService.java
View file @
c5abb58b
package
com
.
egolm
.
payment
.
service
;
import
java.util.Map
;
import
com.egolm.payment.pojo.TSystemCtrl
;
public
interface
SystemCtrlService
{
public
Map
<
String
,
Object
>
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
);
public
TSystemCtrl
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
);
}
src/main/java/com/egolm/payment/service/WxChatService.java
View file @
c5abb58b
...
...
@@ -3,12 +3,14 @@ package com.egolm.payment.service;
import
java.util.Map
;
import
java.util.SortedMap
;
import
com.egolm.payment.pojo.TSystemCtrl
;
public
interface
WxChatService
{
public
Map
<
String
,
Object
>
loadAppID
(
String
code
,
String
langID
);
public
TSystemCtrl
loadAppID
(
String
ctrlCode
,
String
terminal
,
String
langID
);
public
String
getWxOpenId
(
Map
<
String
,
String
>
params
);
public
String
getWxOpenId
(
Map
<
String
,
String
>
params
);
public
Map
<
String
,
String
>
unifiedorder
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
public
Map
<
String
,
String
>
unifiedorder
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
public
Map
<
String
,
String
>
refund
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
public
Map
<
String
,
String
>
refund
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
}
src/main/java/com/egolm/payment/service/impl/SystemCtrlServiceImpl.java
View file @
c5abb58b
package
com
.
egolm
.
payment
.
service
.
impl
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -9,6 +7,7 @@ import org.springframework.stereotype.Service;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.dialect.SqlServerDialect
;
import
com.egolm.payment.pojo.TSystemCtrl
;
import
com.egolm.payment.service.SystemCtrlService
;
@Service
...
...
@@ -20,12 +19,11 @@ public class SystemCtrlServiceImpl implements SystemCtrlService {
private
JdbcTemplate
jdbcTemplate
;
public
Map
<
String
,
Object
>
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
)
{
public
TSystemCtrl
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
)
{
try
{
jdbcTemplate
.
setDialect
(
new
SqlServerDialect
());
String
sql
=
"select sDesc, sSysTypeID, sSysType, sValue1, sValue2, sValue3,sMemo,sValue4,sValue5 from tSystemCtrl where sCode = ? and nTag&1 = 0"
;
Map
<
String
,
Object
>
mapRsult
=
jdbcTemplate
.
queryForMap
(
sql
,
sCode
);
return
mapRsult
;
return
jdbcTemplate
.
queryForBean
(
sql
,
TSystemCtrl
.
class
,
sCode
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"支付服务数据字典查询出错: "
+
e
.
getMessage
());
...
...
src/main/java/com/egolm/payment/service/impl/WeChatServiceImpl.java
View file @
c5abb58b
...
...
@@ -4,8 +4,6 @@ import java.util.Date;
import
java.util.Map
;
import
java.util.SortedMap
;
import
javax.servlet.http.HttpUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -14,6 +12,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.HttpsUtil
;
import
com.egolm.payment.pojo.TSystemCtrl
;
import
com.egolm.payment.service.SystemCtrlService
;
import
com.egolm.payment.service.WxChatService
;
import
com.egolm.payment.util.PayContstrant
;
...
...
@@ -28,7 +27,7 @@ public class WeChatServiceImpl implements WxChatService{
private
String
sslPath
;
@Autowired
private
RedisTemplate
<
String
,
?>
redisTemplate
;
private
RedisTemplate
redisTemplate
;
@Autowired
private
SystemCtrlService
systemCtrlService
;
...
...
@@ -43,18 +42,19 @@ public class WeChatServiceImpl implements WxChatService{
* @return: Map<String,Object>
* @throws
*/
public
Map
<
String
,
Object
>
loadAppID
(
String
code
,
String
langID
)
{
public
TSystemCtrl
loadAppID
(
String
ctrlCode
,
String
terminal
,
String
langID
)
{
System
.
out
.
println
(
redisTemplate
);
System
.
out
.
println
(
redisTemplate
.
opsForHash
());
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisTemplate
.
opsForHash
().
get
(
PayContstrant
.
WX_APP_KEY
,
code
);
System
.
out
.
println
(
map
);
if
(
map
==
null
)
{
map
=
systemCtrlService
.
queryTSystemCtrlByCode
(
code
,
langID
);
if
(
map
!=
null
)
{
redisTemplate
.
opsForHash
().
put
(
PayContstrant
.
WX_APP_KEY
,
code
,
map
);
TSystemCtrl
tSystemCtrl
=
(
TSystemCtrl
)
redisTemplate
.
opsForHash
().
get
(
PayContstrant
.
WX_APP_KEY
,
terminal
);
System
.
out
.
println
(
tSystemCtrl
);
if
(
tSystemCtrl
==
null
)
{
tSystemCtrl
=
systemCtrlService
.
queryTSystemCtrlByCode
(
ctrlCode
,
langID
);
System
.
out
.
println
(
tSystemCtrl
);
if
(
tSystemCtrl
!=
null
)
{
redisTemplate
.
opsForHash
().
put
(
PayContstrant
.
WX_APP_KEY
,
terminal
,
tSystemCtrl
);
}
}
return
map
;
return
tSystemCtrl
;
}
...
...
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