| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> addVipOrder(TVipOrder vipOrder) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TShoppingOrder> shopCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("订单创建" + cause.getMessage()); |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/callBack") |
| | |
| | | @TableField("pay_amount") |
| | | private BigDecimal payAmount; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | @ApiModelProperty(value = "第三方支付流水号") |
| | | @TableField(exist = false) |
| | | private String serailNumber; |
| | | @ApiModelProperty(value = "支付金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @TableField(exist = false) |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | } |
| | |
| | | byId.setAuditStatus(3); |
| | | byId.setTwoRemark(steategyPassDto.getRemark()); |
| | | byId.setTwoAuditTime(LocalDateTime.now()); |
| | | |
| | | //如果parentId不为空,则将parentId对应的siteId改为现在的,并且将parenId对应的数据删除 |
| | | |
| | | |
| | | //将site表对应的模板id修改为新的这个 |
| | | |
| | | } |
| | | }else { |
| | | byId.setAuditStatus(4); |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/callBack") |
| | | public class CallBackController { |
| | | |
| | | @Resource |
| | | private TVipOrderService tVipOrderService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/ali/all") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | tVipOrderService.payBack(out_trade_no); |
| | | break; |
| | | } |
| | | |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | @ApiOperation(value = "退款", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R refund(@RequestBody PayOrderRefundDto payOrderQueryDto) { |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 远程启动失败后退款回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderALICallback") |
| | | public void chargingOrderStartupFailureWxRefund(HttpServletRequest request){ |
| | | WxRefundNotifyResp data = wxPaymentClient.refundNotify(request).getData(); |
| | | if(null != data){ |
| | | String out_refund_no = data.getOut_refund_no(); |
| | | String refund_id = data.getRefund_id(); |
| | | String tradeState = data.getTradeState(); |
| | | String success_time = data.getSuccess_time(); |
| | | chargingOrderService.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | |
| | | } |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult addVipOrder(@RequestBody TVipOrder dto) { |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return AjaxResult.success(); |
| | | return R.ok(dto.getId()); |
| | | } |
| | | @GetMapping("/deleteVipOrder") |
| | | @ApiOperation(value = "批量删除会员订单", tags = {"管理后台-会员订单"}) |
| | |
| | | List<SixVipDto> sixBefore(LocalDate sixBefore); |
| | | |
| | | BigDecimal getSumAmout(LocalDate sixBefore); |
| | | |
| | | void payBack(String outTradeNo); |
| | | } |
| | |
| | | return this.baseMapper.getYearData(chargingOrderIds); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ChargingOrderTimeVO chargingList(ChargingListQuery dto) { |
| | | String startTime1 = null; |
| | |
| | | public void chargeMonitoring(UploadRealTimeMonitoringDataQuery query) { |
| | | // todo 需完善 |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | | TChargingOrder tChargingOrder = this.baseMapper.selectById(payOrderQueryDto.getOrderId()); |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(tChargingOrder.getRechargePaymentType()); |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | | chargingOrderRefund.setRefundRemark("后台退款"); |
| | | chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); |
| | | chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); |
| | | |
| | | if(1 == tChargingOrder.getRechargePaymentType()){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(tChargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getRechargeSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setCurrency("CNY"); |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | if(2 == tChargingOrder.getRechargePaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | |
| | | public BigDecimal getSumAmout(LocalDate sixBefore) { |
| | | return this.baseMapper.getSumAmout(sixBefore); |
| | | } |
| | | |
| | | @Override |
| | | public void payBack(String outTradeNo) { |
| | | //将vip订单改为已完成 |
| | | TVipOrder tVipOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TVipOrder.class).eq(TVipOrder::getCode, outTradeNo)); |
| | | tVipOrder.setPaymentStatus(2); |
| | | this.baseMapper.updateById(tVipOrder); |
| | | //赠送会员 |
| | | GiveVipDto giveVipDto = new GiveVipDto(); |
| | | giveVipDto.setUserIds(tVipOrder.getAppUserId().toString()); |
| | | giveVipDto.setVipId(tVipOrder.getVipId()); |
| | | giveVipDto.setType(tVipOrder.getVipType()); |
| | | // vipClient.giveVip(giveVipDto); |
| | | } |
| | | } |
| | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | | |
| | | select * from (SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_charging_order_refund |
| | | select * from (SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.pay_time |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_shopping_order_refund |
| | | SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.pay_time |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_vip_order_refund) o |
| | | SELECT vr.id, |
| | | vr.`code`, |
| | | vr.refund_code, |
| | | vr.refund_title, |
| | | vr.refund_reason, |
| | | vr.refund_amount, |
| | | vr.refund_total_amount, |
| | | vr.refund_time, |
| | | vr.pay_type, |
| | | vr.pay_amount, |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.pay_time |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | | |
| | | ) o |
| | | <where> |
| | | <if test="data.code != null and data.code != ''"> |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | |
| | | private TVipService vipService; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | |
| | | return R.ok(vipInfoDtos); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam(name = "1月2季3年",value = "buyType") Integer buyType, |
| | | @RequestParam(name = "1微信2支付宝",value = "payType") Integer payType |
| | | ) { |
| | | |
| | | TVip byId = vipService.getById(vipId); |
| | | BigDecimal payMoney = BigDecimal.ZERO; |
| | | BigDecimal discountMoney = BigDecimal.ZERO; |
| | | BigDecimal discount = BigDecimal.ZERO; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | switch (buyType){ |
| | | case 1: |
| | | if (byId.getMonthlyCardDiscountStart()!=null&&(now.isAfter(byId.getMonthlyCardDiscountStart())&&now.isBefore(byId.getMonthlyCardDiscountEnd()))){ |
| | | payMoney = byId.getMonthlyCard().multiply(byId.getMonthlyCardDiscount()); |
| | | discountMoney = byId.getMonthlyCard().subtract(payMoney); |
| | | discount = byId.getMonthlyCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getMonthlyCard(); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (byId.getSeasonCardDiscountStart()!=null&&(now.isAfter(byId.getSeasonCardDiscountStart())&&now.isBefore(byId.getSeasonCardDiscountEnd()))){ |
| | | payMoney = byId.getSeasonCard().multiply(byId.getSeasonCardDiscount()); |
| | | discountMoney = byId.getSeasonCard().subtract(payMoney); |
| | | discount = byId.getSeasonCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getSeasonCard(); |
| | | } |
| | | break; |
| | | case 3: |
| | | if (byId.getAnnualCardDiscountStart()!=null&&(now.isAfter(byId.getAnnualCardDiscountStart())&&now.isBefore(byId.getAnnualCardDiscountEnd()))){ |
| | | payMoney = byId.getAnnualCard().multiply(byId.getAnnualCardDiscount()); |
| | | discountMoney = byId.getAnnualCard().subtract(payMoney); |
| | | discount = byId.getAnnualCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getAnnualCard(); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize); |
| | | |
| | | |
| | | Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize) { |
| | | PageInfo<TVip> pageInfo = new PageInfo<>(pageCurr,pageSize); |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) { |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | //生成会员购买订单 |
| | | |
| | | TVipOrder shopOrder = new TVipOrder(); |
| | | shopOrder.setCode(OrderCodeUtil.getOrderCode("HY")); |
| | | shopOrder.setAppUserId(userId); |
| | | shopOrder.setType(1); |
| | | shopOrder.setVipId(byId.getId()); |
| | | shopOrder.setVipType(buyType); |
| | | shopOrder.setOrderAmount(payMoney.add(discountMoney)); |
| | | shopOrder.setDiscount(discount); |
| | | shopOrder.setDiscountAmount(discountMoney); |
| | | shopOrder.setPaymentAmount(payMoney); |
| | | shopOrder.setPaymentStatus(1); |
| | | shopOrder.setPaymentType(payType); |
| | | shopOrder.setPayTime(LocalDateTime.now()); |
| | | orderClient.addVipOrder(shopOrder).getData(); |
| | | |
| | | |
| | | if (payType==1){ |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | | req.setTotalAmount(shopOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(user.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/allCallBack") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String substring = outRefundNo.substring(0, 2); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | break; |
| | | } |
| | | |
| | | return R.ok(params); |