| | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | }) |
| | | public R<BigDecimal> estimate(@RequestParam String orderId, String city) { |
| | | Order order = orderClient.detail(orderId).getData(); |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery() |
| | | .eq(RecoveryServe::getId, order.getServeId()) |
| | | .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | BigDecimal money = recoveryServe.getDefaultPrice(); |
| | | if (StringUtils.isNotBlank(city)) { |
| | | CityInfoVO info = GaoDeMapUtil.getAddressInfo(city).getDatas(); |
| | | RecoveryServePrice price = recoveryServePriceService.lambdaQuery() |
| | | .eq(RecoveryServePrice::getRecoveryServeId, recoveryServe.getId()) |
| | | .eq(RecoveryServePrice::getCityCode, info.getCode()) |
| | | .eq(RecoveryServePrice::getIsDelete, Constants.ZERO).one(); |
| | | if (null != price) { |
| | | money = price.getRecoveryPrice(); |
| | | } |
| | | } |
| | | return R.ok(money); |
| | | // RecoveryServe recoveryServe = recoveryServeService.lambdaQuery() |
| | | // .eq(RecoveryServe::getId, order.getServeId()) |
| | | // .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | // BigDecimal money = recoveryServe.getDefaultPrice(); |
| | | // if (StringUtils.isNotBlank(city)) { |
| | | // CityInfoVO info = GaoDeMapUtil.getAddressInfo(city).getDatas(); |
| | | // RecoveryServePrice price = recoveryServePriceService.lambdaQuery() |
| | | // .eq(RecoveryServePrice::getRecoveryServeId, recoveryServe.getId()) |
| | | // .eq(RecoveryServePrice::getCity, info.getCode()) |
| | | // .eq(RecoveryServePrice::getIsDelete, Constants.ZERO).one(); |
| | | // if (null != price) { |
| | | // money = price.getRecoveryPrice(); |
| | | // } |
| | | // } |
| | | return R.ok(order.getServePrice()); |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | |
| | | */ |
| | | @GetMapping("/prizeList") |
| | | @ApiOperation(value = "获取奖品列表", tags = {"用户端-订单"}) |
| | | public R<List<Prize>> prizeList() { |
| | | return R.ok(adminClient.prizeList().getData()); |
| | | public R<List<Prize>> prizeList(@RequestParam("serveId") String serveId) { |
| | | return R.ok(adminClient.prizeList(Integer.valueOf(serveId)).getData()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/allowance") |
| | | @ApiOperation(value = "抽奖获取津贴", tags = {"用户端-订单"}) |
| | | public R<Object> obtainAllowance() { |
| | | return R.ok(orderService.obtainAllowance(adminClient.prizeList().getData())); |
| | | public R<Object> obtainAllowance(@RequestParam("serveId") String serveId) { |
| | | return R.ok(orderService.obtainAllowance(adminClient.prizeList(Integer.valueOf(serveId)).getData())); |
| | | } |
| | | |
| | | /** |
| | |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 领取补贴金 |
| | | * |
| | | */ |
| | | @GetMapping("/receivingSubsidies") |
| | | @ApiOperation(value = "领取补贴金", tags = {"用户端-订单-领取补贴金[2.0]"}) |
| | | public R<Object> receivingSubsidies(@RequestParam("serveId") String serveId,@RequestParam("orderId") String orderId) { |
| | | // 查询补贴金 |
| | | RecoveryServe recoveryServe = recoveryServeService.getById(serveId); |
| | | if (Objects.isNull(recoveryServe)) { |
| | | return R.fail("该服务不存在!"); |
| | | } |
| | | orderClient.receiving(orderId,recoveryServe.getRecycleSubsidy()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |