Commit d3fdde6a authored by 胡建龙's avatar 胡建龙

[fix]修复调用业务系统参数错误及事务提交

parent 461ea36e
......@@ -32,7 +32,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.io.File;
import java.text.SimpleDateFormat;
......@@ -49,6 +53,8 @@ public class PingAnServiceImpl implements PingAnService {
private IHlsEbankCcbTransactionService hlsEbankCcbTransactionService;
@Autowired
private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper;
@Autowired
private DataSourceTransactionManager transactionManager;
private Logger logger = LoggerFactory.getLogger(getClass());
......@@ -146,14 +152,28 @@ public class PingAnServiceImpl implements PingAnService {
}
public JSONObject detailNotify(IRequest iRequest, JSONObject data) {
public JSONObject detailNotify(IRequest iRequest, JSONObject req) {
JSONObject responseData = new JSONObject();
logger.info("接收推送消息,推送参数: {}", data.toString());
if (Objects.nonNull(data) && data.size() > 0) {
logger.info("接收推送消息,推送参数: {}", req.toString());
if (Objects.nonNull(req) && req.size() > 0) {
// 存表
//实际通知报文中会把数据放在ROOT这个key下
JSONObject data = req.getJSONObject("ROOT");
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// 事务隔离级别:开启新事务
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
//对于每次请求都开启一个事物
TransactionStatus transactionStatus = transactionManager.getTransaction(def);
HlsEbankCcbTransaction hlsEbankCcbTransaction = saveTransaction(iRequest, data);
//状态刷新
transactionStatus.flush();
//事务提交
transactionManager.commit(transactionStatus);
// 调用系统的接口服务,推送通知数据
postNotify(JSONObject.toJSONString(hlsEbankCcbTransaction));
JSONObject ldo16 = new JSONObject();
ldo16.put("transaction_id",hlsEbankCcbTransaction.getTransactionId());
postNotify(ldo16.toString());
responseData.put("TxnReturnCode ","000000");
responseData.put("TxnReturnMsg ","接收成功");
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment