Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
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
曲欣亮
shop
Commits
58a704cf
Commit
58a704cf
authored
Mar 01, 2023
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
需求 #14327
parent
07c8f8ef
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
884 additions
and
2 deletions
+884
-2
pom.xml
pom.xml
+13
-0
OrderController.java
src/main/java/com/egolm/shop/api/OrderController.java
+19
-0
PayNotifyController.java
src/main/java/com/egolm/shop/api/PayNotifyController.java
+94
-0
OrderService.java
src/main/java/com/egolm/shop/api/service/OrderService.java
+5
-1
OrderServiceImpl.java
...ava/com/egolm/shop/api/service/impl/OrderServiceImpl.java
+39
-1
WxPayResponse.java
src/main/java/com/egolm/shop/bean/WxPayResponse.java
+714
-0
No files found.
pom.xml
View file @
58a704cf
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<maven.build.timestamp>
${maven.build.timestamp}
</maven.build.timestamp>
<maven.build.timestamp>
${maven.build.timestamp}
</maven.build.timestamp>
<maven.build.timestamp.format>
yyyy-MM-dd HH:mm:ss
</maven.build.timestamp.format>
<maven.build.timestamp.format>
yyyy-MM-dd HH:mm:ss
</maven.build.timestamp.format>
<xstream.version>
1.4.1
</xstream.version>
<jdom.version>
2.0.2
</jdom.version>
</properties>
</properties>
<parent>
<parent>
...
@@ -103,6 +105,17 @@
...
@@ -103,6 +105,17 @@
<version>
1.6.4
</version>
<version>
1.6.4
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.thoughtworks.xstream
</groupId>
<artifactId>
xstream
</artifactId>
<version>
${xstream.version}
</version>
</dependency>
<dependency>
<groupId>
org.jdom
</groupId>
<artifactId>
jdom
</artifactId>
<version>
${jdom.version}
</version>
</dependency>
<!-- 阿里云 start -->
<!-- 阿里云 start -->
<dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<groupId>
com.aliyun
</groupId>
...
...
src/main/java/com/egolm/shop/api/OrderController.java
View file @
58a704cf
...
@@ -371,4 +371,23 @@ public class OrderController {
...
@@ -371,4 +371,23 @@ public class OrderController {
return
Rjx
.
jsonOk
().
toJson
();
return
Rjx
.
jsonOk
().
toJson
();
}
}
@ApiOperation
(
"提交补款记录"
)
@RequestMapping
(
value
=
"/createSalesOrderDebtPay"
,
method
=
RequestMethod
.
POST
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"shopNO"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"salesOrderID"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"subOrderID"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"payTypeID"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"payType"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"payAmount"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"payCardNO"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
true
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
public
String
createSalesOrderDebtPay
(
String
shopNO
,
String
salesOrderID
,
String
subOrderID
,
String
payTypeID
,
String
payType
,
String
payAmount
,
String
payCardNO
)
{
List
<
Map
<
String
,
Object
>>
list
=
orderService
.
createSalesOrderDebtPay
(
shopNO
,
salesOrderID
,
subOrderID
,
payTypeID
,
payType
,
payAmount
,
payCardNO
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
list
).
toJson
();
}
}
}
src/main/java/com/egolm/shop/api/PayNotifyController.java
0 → 100644
View file @
58a704cf
package
com
.
egolm
.
shop
.
api
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.dom4j.DocumentHelper
;
import
org.json.XML
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.HttpsUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.shop.api.service.OrderService
;
import
com.egolm.shop.bean.WxPayResponse
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.io.xml.DomDriver
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"支付相关接口"
})
@RestController
@RequestMapping
(
"pay"
)
public
class
PayNotifyController
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PayNotifyController
.
class
);
@Autowired
private
OrderService
orderService
;
@ApiOperation
(
"支付回调通知接口"
)
@RequestMapping
(
value
=
"/callback"
,
method
=
RequestMethod
.
POST
)
public
Object
callback
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
{
WxPayResponse
postData
=
null
;
try
{
// 转换微信post过来的xml内容
ServletInputStream
in
=
req
.
getInputStream
();
XStream
xs
=
new
XStream
(
new
DomDriver
());
xs
.
setClassLoader
(
WxPayResponse
.
class
.
getClassLoader
());
xs
.
alias
(
"xml"
,
WxPayResponse
.
class
);
String
xmlMsg
=
StringUtil
.
inputStream2String
(
in
);
logger
.
info
(
"接收到回调信息 {}"
,
xmlMsg
);
postData
=
(
WxPayResponse
)
xs
.
fromXML
(
xmlMsg
);
List
<
Map
<
String
,
Object
>>
returnMap
=
orderService
.
payCallback
(
postData
);
logger
.
info
(
"处理回调信息结果 {}"
,
GsonUtil
.
toJson
(
returnMap
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
"success"
;
}
public
static
void
main
(
String
[]
args
)
{
String
xml
=
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n"
+
"<xml>\r\n"
+
"<appid><![CDATA[wxb934522389d47388]]></appid>\r\n"
+
"<bank_type><![CDATA[OTHERS]]></bank_type>\r\n"
+
"<cash_fee><![CDATA[1]]></cash_fee>\r\n"
+
"<fee_type><![CDATA[CNY]]></fee_type>\r\n"
+
"<is_subscribe><![CDATA[N]]></is_subscribe>\r\n"
+
"<mch_id><![CDATA[829004816000155]]></mch_id>\r\n"
+
"<nonce_str><![CDATA[1677568978015]]></nonce_str>\r\n"
+
"<openid><![CDATA[o-8AO5C3MIpEWiMQqlWTSvbnUhtQ]]></openid>\r\n"
+
"<out_trade_no><![CDATA[16775689551728_967438]]></out_trade_no>\r\n"
+
"<pay_type><![CDATA[120]]></pay_type>\r\n"
+
"<result_code><![CDATA[SUCCESS]]></result_code>\r\n"
+
"<return_code><![CDATA[SUCCESS]]></return_code>\r\n"
+
"<sign><![CDATA[017EC9868E1BD27A1BF786F69605E8FF]]></sign>\r\n"
+
"<time_end><![CDATA[20230228152257]]></time_end>\r\n"
+
"<total_fee><![CDATA[1]]></total_fee>\r\n"
+
"<trade_type><![CDATA[LCSW_+010]]></trade_type>\r\n"
+
"<transaction_id><![CDATA[4200001803202302280221844190]]></transaction_id>\r\n"
+
"</xml>"
;
String
url
=
"http://localhost:30005/shop/pay/callback"
;
String
result
=
HttpsUtil
.
doPostForXml
(
url
,
xml
);
System
.
out
.
println
(
result
);
}
}
\ No newline at end of file
src/main/java/com/egolm/shop/api/service/OrderService.java
View file @
58a704cf
...
@@ -8,6 +8,7 @@ import java.util.Map;
...
@@ -8,6 +8,7 @@ import java.util.Map;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.shop.bean.RespObject
;
import
com.egolm.shop.bean.RespObject
;
import
com.egolm.shop.bean.WxPayResponse
;
public
interface
OrderService
{
public
interface
OrderService
{
...
@@ -40,5 +41,8 @@ public interface OrderService {
...
@@ -40,5 +41,8 @@ public interface OrderService {
public
RespObject
queryRefundOrderList
(
String
orgNo
,
String
shopNo
,
Integer
refundStatus
,
String
langID
,
Page
page
);
public
RespObject
queryRefundOrderList
(
String
orgNo
,
String
shopNo
,
Integer
refundStatus
,
String
langID
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
createSalesOrderDebtPay
(
String
shopNO
,
String
salesOrderID
,
String
subOrderID
,
String
payTypeID
,
String
payType
,
String
payAmount
,
String
payCardNO
)
;
public
List
<
Map
<
String
,
Object
>>
payCallback
(
WxPayResponse
postData
);
}
}
src/main/java/com/egolm/shop/api/service/impl/OrderServiceImpl.java
View file @
58a704cf
...
@@ -9,6 +9,8 @@ import java.util.List;
...
@@ -9,6 +9,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.jdbc.UncategorizedSQLException
;
import
org.springframework.jdbc.UncategorizedSQLException
;
...
@@ -29,11 +31,13 @@ import com.egolm.shop.api.service.OrderService;
...
@@ -29,11 +31,13 @@ import com.egolm.shop.api.service.OrderService;
import
com.egolm.shop.bean.RespObject
;
import
com.egolm.shop.bean.RespObject
;
import
com.egolm.shop.bean.TSalesOrder
;
import
com.egolm.shop.bean.TSalesOrder
;
import
com.egolm.shop.bean.TSalesOrderDtl
;
import
com.egolm.shop.bean.TSalesOrderDtl
;
import
com.egolm.shop.bean.WxPayResponse
;
import
com.egolm.shop.common.XException
;
import
com.egolm.shop.common.XException
;
import
com.egolm.shop.common.utils.I18NUtils
;
import
com.egolm.shop.common.utils.I18NUtils
;
import
com.qcloud.cos.utils.DateUtils
;
@Service
@Service
public
class
OrderServiceImpl
implements
OrderService
{
public
class
OrderServiceImpl
implements
OrderService
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
OrderServiceImpl
.
class
);
@Autowired
@Autowired
private
JdbcTemplate
jdbcTemplate
;
private
JdbcTemplate
jdbcTemplate
;
...
@@ -1042,4 +1046,38 @@ public class OrderServiceImpl implements OrderService {
...
@@ -1042,4 +1046,38 @@ public class OrderServiceImpl implements OrderService {
return
new
RespObject
(
result
);
return
new
RespObject
(
result
);
}
}
//提交补款记录
public
List
<
Map
<
String
,
Object
>>
createSalesOrderDebtPay
(
String
shopNO
,
String
salesOrderID
,
String
subOrderID
,
String
payTypeID
,
String
payType
,
String
payAmount
,
String
payCardNO
)
{
List
<
Map
<
String
,
Object
>>
returnMap
=
new
ArrayList
<
Map
<
String
,
Object
>>();
try
{
String
sql
=
"exec up_CreateSalesOrderDebtPay '"
+
shopNO
+
"' ,'"
+
salesOrderID
+
"' , '"
+
subOrderID
+
"' , '"
+
payTypeID
+
"' , '"
+
payType
+
"' , '"
+
payAmount
+
"' , '"
+
payCardNO
+
"' "
;
returnMap
=
jdbcTemplate
.
executeMutil
(
sql
).
getDatas
().
get
(
0
);
return
returnMap
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
returnMap
;
}
//回调标记已补款
public
List
<
Map
<
String
,
Object
>>
payCallback
(
WxPayResponse
postData
)
{
List
<
Map
<
String
,
Object
>>
returnMap
=
new
ArrayList
<
Map
<
String
,
Object
>>();
String
OutTradeNO
=
postData
.
getOut_trade_no
();
String
TransactionID
=
postData
.
getTransaction_id
();
String
PayCardNO
=
postData
.
getOpenid
();
String
PayAmount
=
postData
.
getTotal_fee
().
toString
();
String
PayDate
=
postData
.
getTime_end
();
String
PayChannel
=
postData
.
getPay_type
();
String
paydate
=
DateUtil
.
format
(
DateUtil
.
parse
(
PayDate
,
DateUtil
.
FMT_YYYYMMddHHMMSS
),
DateUtil
.
FMT_DATE_SECOND
);
try
{
String
sql
=
"exec up_B2BSalesOrderDebtPayCallBack '"
+
OutTradeNO
+
"' ,'"
+
TransactionID
+
"' , '"
+
PayCardNO
+
"' , '"
+
PayAmount
+
"' , '"
+
paydate
+
"' , '"
+
PayChannel
+
"' "
;
returnMap
=
jdbcTemplate
.
executeMutil
(
sql
).
getDatas
().
get
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
returnMap
;
}
}
}
src/main/java/com/egolm/shop/bean/WxPayResponse.java
0 → 100644
View file @
58a704cf
This diff is collapsed.
Click to expand it.
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