| | |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import org.json.JSONObject; |
| | |
| | | @Controller |
| | | @RequestMapping("alipay") |
| | | public class AlipayController { |
| | | Logger logger = LoggerFactory.getLogger(AlipayController.class); |
| | | Logger logger = LoggerUtil.getVIPLogger(); |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | |
| | | if (right) { |
| | | //支付成功 |
| | | if ("TRADE_SUCCESS".equalsIgnoreCase(tradeStatus)) { |
| | | AlipayTradeQueryResponse res = AlipayH5PayUtil.queryOrder(app, outTradeNo, null); |
| | | //支付成功 |
| | | if (res.isSuccess() && "TRADE_SUCCESS".equalsIgnoreCase(res.getTradeStatus())) { |
| | | String id = VIPOrderUtil.getIdFromOutOrderNo(outTradeNo); |
| | | try { |
| | | vipService.paySuccess(id, VIPOrderRecord.PAY_WAY_ALIPAY, new BigDecimal(res.getPayAmount()), new Date()); |
| | | } catch (VIPException e) { |
| | | e.printStackTrace(); |
| | | logger.error("支付成功回调出错 id:{}", id, e); |
| | | } |
| | | } |
| | | String id = VIPOrderUtil.getIdFromOutOrderNo(outTradeNo); |
| | | logger.info("订单ID:{}", id); |
| | | vipService.checkOrderPayState(id); |
| | | } |
| | | response.getWriter().print("success"); |
| | | response.getWriter().close(); |