| | |
| | | import com.ruoyi.system.utils.wx.WxProperties; |
| | | import com.ruoyi.system.vo.MyPushCompanyListVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.annotation.OrderUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.net.MalformedURLException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private WxPayService wxPayService; |
| | | |
| | | |
| | | @Autowired |
| | | private TbSystemConfigService configService; |
| | |
| | | |
| | | @Override |
| | | public WxPayMpOrderResult payOrder(TbOrder tbOrder, Long userId) { |
| | | WxPayMpOrderResult result = this.createWxOrderToWxService(tbOrder.getUserId(),tbOrder.getOrderNo(),tbOrder.getPrice(),"购买商品", ""); |
| | | TbUser user = userService.getById(userId); |
| | | WxPayMpOrderResult result = this.createWxOrderToWxService(user.getOpenId(),tbOrder.getOrderNo(),tbOrder.getPrice(),"购买商品", ""); |
| | | return result; |
| | | } |
| | | |
| | |
| | | BigDecimal userCommissionMoney = divide1.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | order.setCommissionPrice(userCommissionMoney); |
| | | } |
| | | order.setShare_user_id(user.getInviteId()); |
| | | order.setShareUserId(user.getInviteId()); |
| | | order.setCommissionPlatform(platformCommissionMoney); |
| | | } |
| | | order.updateById(); |
| | |
| | | |
| | | @Override |
| | | public void commission(TbOrder order,String userId) { |
| | | String shareUserId = order.getShare_user_id(); |
| | | String shareUserId = order.getShareUserId(); |
| | | if(StringUtils.isNotEmpty(shareUserId)){ |
| | | TbUser shareUser = userService.getById(shareUserId); |
| | | BigDecimal add = shareUser.getBalance().add(order.getCommissionPrice()); |
| | |
| | | BigDecimal add = user.getBalance().add(decimal); |
| | | user.setBalance(add); |
| | | user.updateById(); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | wxPayUnifiedOrderRequest.setBody("购买商品"); |
| | | wxPayUnifiedOrderRequest.setOutTradeNo(outTradeNo); |
| | | wxPayUnifiedOrderRequest.setTotalFee(amountInFen);// 元转成分 |
| | | wxPayUnifiedOrderRequest.setOpenid(openId); |
| | | wxPayUnifiedOrderRequest.setSpbillCreateIp( |
| | | InetAddress.getLoopbackAddress().getHostAddress()); |
| | | wxPayUnifiedOrderRequest.setTradeType("JSAPI"); |