pos交易查询增加打印和交易状态判断
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
index 7644bdc..56ac747 100644
--- a/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
@@ -416,7 +416,14 @@
resp.setRetmsg("客户" + tTransdtl.getCustid() + "不存在");
return resp;
}
- Double amount = req.getAmount() / 100.0;
+ Integer amt=req.getAmount();
+ if(null==amt||0==amt){
+ resp.setRetcode(ErrorCode.ERRIF_POSDTL_NOTEXIST);
+ resp.setRetmsg("交易金额不得为0");
+
+ return resp;
+ }
+ Double amount = amt/ 100.0;
Double cntamount = 0.0;
logger.info("交易号:" + tTransdtl.getBillno() + ",,,交易金额:" + req.getAmount());
DiscountBean bean = deviceDiscountRuleService.getCustomerDiscount(tDevice.getId(), req.getTermtime(), cus.getCustid());
@@ -453,8 +460,6 @@
tTransdtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_WAIT);
TTransDtl dtl = transDtlService.saveTransdtl(tTransdtl);
-
-
/* if(RestaurantConstant.TRANSMODE_CODE.equals(dtl.getTransmode())){
DoorQRCodeParam qrparam=new DoorQRCodeParam();
qrparam.setAmount(MoneyUtil.YuanToFen(tTransdtl.getAmount()));
@@ -485,7 +490,7 @@
param.setAmount(MoneyUtil.YuanToFen(dtl.getAmount()));
param.setDtltype("canteen");
CitizenPayResponse response = citizenCardPayProxy.citizencardPayinit(param);
- if (response.getRetcode() == 0) {
+ if (response.getRetcode() == 0||!StringUtil.isEmpty(response.getRetmsg())) {
tTransdtl.setRefno(response.getRefno());
CitizenCardPayfinishParam confirmParam = new CitizenCardPayfinishParam();
confirmParam.setRefno(response.getRefno());
@@ -548,17 +553,35 @@
resp.setRetmsg("交易参考号" + req.getBillno() + "不存在");
return resp;
}
+ if(RestaurantConstant.CHKFILE_STATUS_INIT.equals(tTransdtl.getStatus())){
+ resp.setRetcode(ErrorCode.ERRIF_POSDTL_NOTEXIST);
+ resp.setRetmsg("交易超时");
+ return resp;
+ }
QueryDtlResultParam param = new QueryDtlResultParam();
param.setRefno(tTransdtl.getRefno());
param.setBillno(tTransdtl.getBillno());
param.setShopaccno(tTransdtl.getShopid());
QueryTransDtlResponse queryresp = transactionProxy.queryDtlResult(param);
+ if(0!=queryresp.getRetcode()){
+ resp.setRetcode(queryresp.getRetcode()+"");
+ resp.setRetmsg(queryresp.getRetmsg());
+ return resp;
+ }
+ logger.info("查询交易参考号:"+queryresp.getRefno()+";;流水状态:"+queryresp.getStatus()+";;查询接口返回:"+queryresp.getRetmsg());
+
+ if(RestaurantConstant.CHKDTL_RESOLVED_FAIL.equals(queryresp.getStatus())){
+ resp.setRetcode(ErrorCode.ERRIF_POSDTL_NOTEXIST);
+ resp.setRetmsg("交易失败");
+ return resp;
+ }
if (RestaurantConstant.STATUS_TRANSDTL_WAIT.equals(queryresp.getStatus())) {
resp.setRequire_query(true);
} else {
resp.setRequire_query(false);
}
+
resp.setBillno(tTransdtl.getBillno());
Double retAmount = tTransdtl.getAmount() * 100;
resp.setAmount(retAmount.intValue());