| | |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.internal.util.AlipaySignature; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.yeshi.buwan.domain.vip.VIPOrderRecord; |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | 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; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.alipay.AlipayH5PayUtil; |
| | | import org.yeshi.utils.entity.alipay.AlipayAppInfo; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | |
| | | @Controller |
| | | @RequestMapping("alipay") |
| | | public class AlipayController { |
| | | Logger logger = LoggerFactory.getLogger(AlipayController.class); |
| | | Logger logger = LoggerUtil.getVIPLogger(); |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private VIPService vipService; |
| | | |
| | | @RequestMapping("printPayForm") |
| | | public void printPayForm(String formId, HttpServletResponse response) { |
| | |
| | | String outTradeNo = map.get("out_trade_no"); |
| | | String tradeStatus = map.get("trade_status"); |
| | | |
| | | //支付成功 |
| | | if ("TRADE_SUCCESS".equalsIgnoreCase(tradeStatus)) { |
| | | |
| | | } |
| | | |
| | | logger.info("支付回调:" + new JSONObject(map).toString()); |
| | | AlipayAppInfo app = VipUtil.getAlipayApp(); |
| | |
| | | try { |
| | | boolean right = AlipaySignature.rsaCheckV1(map, app.getAlipayPublicKey(), "GBK", map.get("sign_type")); |
| | | if (right) { |
| | | //支付成功 |
| | | if ("TRADE_SUCCESS".equalsIgnoreCase(tradeStatus)) { |
| | | String id = VIPOrderUtil.getIdFromOutOrderNo(outTradeNo); |
| | | logger.info("订单ID:{}", id); |
| | | vipService.checkOrderPayState(id); |
| | | } |
| | | response.getWriter().print("success"); |
| | | response.getWriter().close(); |
| | | } |