| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/sureVerifyOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "核销订单") //todo 分账 |
| | | @ApiOperation(value = "核销订单") |
| | | public R<MerVerifyOrderVo> sureVerifyOrder(@RequestBody MerVerifyOrderDto merVerifyOrderDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | merVerifyOrderDto.setUserId(userId); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/placeOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "创建订单")//todo 支付 |
| | | @ApiOperation(value = "创建订单") |
| | | public R<AppPlaceOrderVo> placeOrder(@RequestBody AppPlaceOrderDto appPlaceOrderDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userId = loginUser.getUserid(); |
| | | // if(1==1){ |
| | | // throw new ServiceException("支付功能尚未开通,请联系客服"); |
| | | // } |
| | | appPlaceOrderDto.setUserId(userId); |
| | | appPlaceOrderDto.setSpbillCreateIp(loginUser.getIpaddr()); |
| | | AppPlaceOrderVo appPlaceOrderVo = orderService.placeOrder(appPlaceOrderDto); |
| | |
| | | public R<AppPlaceOrderVo> placeActivityOrder(@Validated @RequestBody AppPlaceActivityDto appPlaceActivityDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userId = loginUser.getUserid(); |
| | | // if(1==1){ |
| | | // throw new ServiceException("支付功能尚未开通,请联系客服"); |
| | | // } |
| | | appPlaceActivityDto.setUserId(userId); |
| | | appPlaceActivityDto.setSpbillCreateIp(loginUser.getIpaddr()); |
| | | AppPlaceOrderVo appPlaceOrderVo = orderService.placeActivityOrder(appPlaceActivityDto); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/payOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "支付订单")//todo 支付 |
| | | @ApiOperation(value = "支付订单") |
| | | public R<AppPlaceOrderVo> payOrder(@RequestBody AppBaseGetDto appBaseGetDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | AppPlaceOrderVo appPlaceOrderVo = orderService.payOrder(appBaseGetDto.getId()); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/cancelOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "取消订单")//todo 退款 |
| | | @ApiOperation(value = "取消订单") |
| | | public R cancelOrder(@RequestBody AppBaseGetDto appBaseGetDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | orderService.cancelOrder(appBaseGetDto.getId()); |
| | |
| | | } |
| | | appPlaceOrderVo.setEndTime(DateUtils.addMinutes(order.getCreateTime(), delayTime)); |
| | | // 小程序微信下单支付 |
| | | createWxPayInfo(appPlaceOrderVo, userId, order.getShopId(), orderGoods.getGoodsName(), outTradeNo, |
| | | // createWxPayInfo(appPlaceOrderVo, userId, order.getShopId(), orderGoods.getGoodsName(), outTradeNo, |
| | | // orderId, order.getPayMoney(), appPlaceActivityDto.getOpenid(), |
| | | // appPlaceActivityDto.getSpbillCreateIp()); |
| | | |
| | | // 小程序微信下单支付 TODO 更换支付渠道(汇付天下) |
| | | createWxPayInfo1(appPlaceOrderVo, userId, order.getShopId(), orderGoods.getGoodsName(), outTradeNo, |
| | | orderId, order.getPayMoney(), appPlaceActivityDto.getOpenid(), |
| | | appPlaceActivityDto.getSpbillCreateIp()); |
| | | //生成自动取消订单延时任务 |
| | |
| | | Order order = this.getById(orderId); |
| | | if (order.getOrderStatus() != 2) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_USED); |
| | | } |
| | | //判断商户是否有分账权限 |
| | | Shop shop = remoteShopService.getShop(shopId).getData(); |
| | | if(shop.getAccountFlag()!=1){ |
| | | throw new ServiceException(AppErrorConstant.SHOP_NO_VERIFY); |
| | | } |
| | | // 根据订单用户ID获取用户信息 |
| | | Member member = remoteMemberService.getMember(order.getUserId()).getData(); |
| | |
| | | BigDecimal proportionPercent = null; |
| | | //商户订单获取统一分成 活动订单获取活动分成 |
| | | if(orderFrom==1){ |
| | | if(null == vo.getShareRatio()){ |
| | | proportionPercent = new BigDecimal(redisService.getCacheObject(SecurityConstant.SHOP_COMMON_PROPORTION).toString()); |
| | | }else{ |
| | | proportionPercent = new BigDecimal(vo.getShareRatio()); |
| | | } |
| | | }else{ |
| | | R<ShopProportionVo> resultShopProportion = remoteShopService.getShopProportion(shopId); |
| | | shopProportion = resultShopProportion.getData(); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("div_amt", String.format("%.2f", multiply.doubleValue())); |
| | | jsonObject.put("huifu_id", vo.getHuifuId()); |
| | | acctInfos.add(jsonObject); |
| | | //平台商户 |
| | | double pt_amount = orderMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | JSONObject jsonObject1 = new JSONObject(); |
| | |
| | | jsonObject.put("div_amt", String.format("%.2f", 0.07D)); |
| | | jsonObject.put("huifu_id", "6666000141251275"); |
| | | acctInfos.add(jsonObject); |
| | | //平台商户 |
| | | com.alibaba.fastjson2.JSONObject jsonObject1 = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject1.put("div_amt", String.format("%.2f", 0.03D)); |
| | | jsonObject1.put("huifu_id", "6666000141216769"); |
| | | acctInfos.add(jsonObject1); |
| | | HuiFuTianXiaUtil.paymentDelaytrans(IdUtils.simpleUUID(), "20231020", "0479854e057547698be8b083f2fa550a", acctInfos); |
| | | } |
| | | } |
| | |
| | | } |
| | | return R.fail(resp_desc); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | HuiFuTianXiaUtil.getMerchantBasicdataSettlement(IdUtils.simpleUUID(), "6666000141251275", "20231023", "20231023", "1", "10"); |
| | | } |
| | | } |