| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.domain.pojo.OrderAuctionBond; |
| | | import com.ruoyi.order.domain.pojo.Paylog; |
| | | import com.ruoyi.order.mapper.OrderAuctionBondMapper; |
| | | import com.ruoyi.order.service.IOrderAuctionBondService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.service.IPaylogService; |
| | | import com.ruoyi.order.util.SinataUtil; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private IOrderAuctionBondService iOrderAuctionBondService; |
| | | @Override |
| | | public void getOrderAuctionBond( OrderAuctionBondDTO orderAuctionBondDTO) { |
| | | |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.notIn(OrderAuctionBond::getMemberId,orderAuctionBondDTO.getUserList()); |
| | | wrapper.eq(OrderAuctionBond::getDelFlag,0); |
| | | wrapper.eq(OrderAuctionBond::getAuctionSalesroomId,orderAuctionBondDTO.getAuctionSalesroomId()); |
| | | List<OrderAuctionBond> orderAuctionBondList=iOrderAuctionBondService.list(wrapper); |
| | | for (OrderAuctionBond orderAuctionBond:orderAuctionBondList){ |
| | | @Resource |
| | | private IPaylogService iPaylogService; |
| | | |
| | | @Resource |
| | | private PaylogServiceImpl paylogServiceImpl; |
| | | |
| | | @Override |
| | | public R<T> getOrderAuctionBond(OrderAuctionBondDTO orderAuctionBondDTO) { |
| | | |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.notIn(OrderAuctionBond::getMemberId, orderAuctionBondDTO.getUserList()); |
| | | wrapper.eq(OrderAuctionBond::getDelFlag, 0); |
| | | wrapper.eq(OrderAuctionBond::getAuctionSalesroomId, orderAuctionBondDTO.getAuctionSalesroomId()); |
| | | List<OrderAuctionBond> orderAuctionBondList = iOrderAuctionBondService.list(wrapper); |
| | | for (OrderAuctionBond orderAuctionBond : orderAuctionBondList) { |
| | | |
| | | LambdaQueryWrapper<Paylog> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.notIn(Paylog::getOutTradeNo, orderAuctionBond.getOrderNo()); |
| | | wrapper1.last("limit 1"); |
| | | Paylog paylog = iPaylogService.getOne(wrapper1); |
| | | |
| | | if (paylog.getPayType() == 1) {//支付宝 |
| | | boolean bo = paylogServiceImpl.refundForAlipay(paylog.getOutTradeNo(), paylog.getTradeNo(), orderAuctionBond.getBond().doubleValue()); |
| | | if (!bo) { |
| | | return R.fail("支付宝退款失败!"); |
| | | } |
| | | } else {//微信 |
| | | String refundMoney = SinataUtil.doubleRetainTwo(orderAuctionBond.getBond().doubleValue() * 100d); |
| | | Integer refundFee = Integer.parseInt(refundMoney.substring(0, refundMoney.length() - 3)); |
| | | String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); |
| | | Integer totalFee = Integer.parseInt(money.substring(0, money.length() - 3)); |
| | | boolean bo = paylogServiceImpl.refundForWxpay(1, paylog.getTradeNo(), paylog.getOutTradeNo(), orderAuctionBond.getOrderNo(), totalFee, refundFee, "2"); |
| | | if (!bo) { |
| | | return R.fail("微信退款失败!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |