| | |
| | | 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.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | |
| | | } |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder"}, logical = Logical.OR) |
| | | @PostMapping("/getShoppingOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<PageInfo<TShoppingOrder>> getShoppingOrderList(@RequestBody ShoppingOrderQuery query) { |
| | |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/getShoppingOrderInfoById") |
| | | @ApiOperation(value = "根据订单id查看订单详情", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<TShoppingOrder> getShoppingOrderList(String id) { |
| | |
| | | return AjaxResult.success(byId); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/del"}, logical = Logical.OR) |
| | | @GetMapping("/deleteShoppingOrder") |
| | | @ApiOperation(value = "批量删除订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<TShoppingOrder> deleteShoppingOrder(String ids) { |
| | | shoppingOrderService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/cancel"}, logical = Logical.OR) |
| | | @GetMapping("/cancelShoppingOrder") |
| | | @ApiOperation(value = "取消订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | |
| | | // todo 根据支付方式 取消订单 |
| | | byId.setCancellationId(userid); |
| | | byId.setCancellationTime(LocalDateTime.now()); |
| | | byId.setStatus(4); |
| | | byId.setStatus(5); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | TShoppingOrderRefund tShoppingOrderRefund = new TShoppingOrderRefund(); |
| | | tShoppingOrderRefund.setPayTime(byId.getPayTime()); |
| | |
| | | refundAmount.setCurrency("CNY"); |
| | | refundAmount.setRefund(i); |
| | | wxPaymentRefundModel.setAmount(refundAmount); |
| | | R<String> stringR = wxPaymentClient.refundOrderR(wxPaymentRefundModel); |
| | | R<Map<String, Object>> stringR = wxPaymentClient.refundOrderR(wxPaymentRefundModel); |
| | | if(200 == stringR.getCode()){ |
| | | shoppingOrderRefundService.save(tShoppingOrderRefund); |
| | | //手续费 |
| | | Map<String, Object> amount1 = (Map<String, Object>) stringR.getData().get("amount"); |
| | | Object refund_fee1 = amount1.get("refund_fee"); |
| | | BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100)); |
| | | tShoppingOrderRefund.setRefundFee(refund_fee); |
| | | shoppingOrderRefundService.updateById(tShoppingOrderRefund); |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/consignerShoppingOrder") |
| | | @ApiOperation(value = "发货", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult consignerShoppingOrder(String id, String companyName, String code) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderList") |
| | | @ApiOperation(value = "获取购买订单列表", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult<Map<String, Object>> getMyShoppingOrderList(GetMyShoppingOrderList query) { |
| | | Map<String, Object> list = shoppingOrderService.getMyShoppingOrderList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderListNum") |
| | | @ApiOperation(value = "获取购买订单列表数量", tags = {"小程序-商城购买订单"}) |
| | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderInfo/{id}") |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单", "管理后台-支付订单-订单信息"}) |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"管理后台-支付订单-订单信息"}) |
| | | public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyShoppingOrderInfo info = shoppingOrderService.getMyShoppingOrderInfo(id); |
| | | return AjaxResult.success(info); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderInfo1/{id}") |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo1(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyShoppingOrderInfo info = shoppingOrderService.getMyShoppingOrderInfo(id); |
| | | return AjaxResult.success(info); |
| | | } |
| | | |
| | | @Log(title = "【我的】确认收货操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @PutMapping("/confirmReceipt/{id}") |
| | | @ApiOperation(value = "确认收货操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult confirmReceipt(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | if (shoppingOrder.getStatus() == 3) { |
| | | return AjaxResult.error("不能重复确认收货"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】取消订单操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @PutMapping("/cancelOrder/{id}") |
| | | @ApiOperation(value = "取消订单操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult cancelOrder(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return shoppingOrderService.cancelOrder(id); |
| | | } |
| | | |