| | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | |
| | | } |
| | | |
| | | String payOrderNo = paymentCompetition.getPayOrderNo(); |
| | | if (paymentCompetition.getPayType() == 1) {//微信支付 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), |
| | | "/base/competition/weChatCancelPaymentCompetitionCallback"); |
| | | String return_code = map.get("return_code"); |
| | | if (!"SUCCESS".equals(return_code)) { |
| | | return ResultUtil.error(map.get("return_msg")); |
| | | } |
| | | String refund_id = map.get("refund_id"); |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | Store store = storeClient.queryStoreById(Integer.valueOf(competition.getStoreId().split(",")[0])); |
| | | |
| | | storeClient.addBackRecord(paymentCompetition.getAmount() + "_" + paymentCompetition.getAppUserId()); |
| | | if (paymentCompetition.getPayType() == 1) {//微信支付 |
| | | if (store.getOperatorId()!=null && store.getOperatorId()!=0){ |
| | | String smidVx= storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | if (!StringUtils.hasLength(smidVx)){ |
| | | System.err.println("运营商未配置微信商户号,获取支付失败!"); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String codeRefund = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);// 退款单号 |
| | | // 运营商退款 |
| | | payMoneyUtil.weixinRefundV3(smidVx, codeRefund, paymentCompetition.getPayOrderNo(), paymentCompetition.getAmount().toString(), "/base/competition/weChatCancelPaymentCompetitionCallback1"); |
| | | }else { |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), |
| | | "/base/competition/weChatCancelPaymentCompetitionCallback"); |
| | | String return_code = map.get("return_code"); |
| | | if (!"SUCCESS".equals(return_code)) { |
| | | return ResultUtil.error(map.get("return_msg")); |
| | | } |
| | | String refund_id = map.get("refund_id"); |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | storeClient.addBackRecord(paymentCompetition.getAmount() + "_" + paymentCompetition.getAppUserId()); |
| | | } |
| | | } |
| | | if (paymentCompetition.getPayType() == 2) {//支付宝支付 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(payOrderNo, amount.toString()); |