| | |
| | | package com.ruoyi.goods.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.util.UUIDUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import com.ruoyi.goods.domain.*; |
| | | import com.ruoyi.goods.dto.*; |
| | | import com.ruoyi.goods.service.*; |
| | | import com.ruoyi.goods.utils.MyQrCodeUtil; |
| | | import com.ruoyi.goods.utils.QRCodeUtil; |
| | | import com.ruoyi.goods.vo.GoodDetailVO; |
| | | import com.ruoyi.goods.vo.TGoodsVO; |
| | | import com.ruoyi.goods.vo.TOrderVO; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.logging.log4j.core.util.UuidUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.awt.image.BufferedImage; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | |
| | | wrapper.eq("isDelete", 0); |
| | | return R.ok(goodsService.page(new PageInfo<>(goodQuery.getPageNumber(), goodQuery.getPageSize()), wrapper)); |
| | | } |
| | | |
| | | @PostMapping("/goodListStudy") |
| | | @ApiOperation(value = "商品列表查询", tags = {"学习端"}) |
| | | public R<PageInfo<TGoods>> goodListStudy(@RequestBody GoodQueryDTO goodQuery) { |
| | |
| | | return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, tokenService.getLoginUserStudy().getUserid()) |
| | | .orderByDesc(TOrder::getCreateTime).list()); |
| | | } |
| | | |
| | | @GetMapping("/exchangeRecordParent") |
| | | @ApiOperation(value = "家长端-兑换记录", tags = {"家长端-兑换记录"}) |
| | | public R<List<TOrder>> exchangeRecordParent() { |
| | |
| | | byId.setState(3); |
| | | return R.ok(orderService.updateById(byId)); |
| | | } |
| | | |
| | | /** |
| | | * 兑换记录 |
| | | */ |
| | |
| | | return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId, |
| | | tokenService.getLoginUser1().getUserid()).list()); |
| | | } |
| | | |
| | | /** |
| | | * 设置默认地址 |
| | | */ |
| | |
| | | recipientService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 设置默认地址 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据地址id 获取详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | Recipient byId = recipientService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | /** |
| | | * 根据地址id 获取详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | Recipient byId = recipientService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户收货地址 |
| | | */ |
| | |
| | | @PostMapping("/addressSaveOrUpdate") |
| | | @ApiOperation(value = "学习端-新增收货地址/修改收货地址", tags = {"学习端-新增收货地址/修改收货地址"}) |
| | | public R<String> addressSave(@RequestBody Recipient recipient) { |
| | | recipient.setUserId(tokenService.getLoginUserStudy().getUserid()); |
| | | recipientService.addressSaveOrUpdate(recipient); |
| | | return R.ok(); |
| | | return R.ok(recipientService.addressSaveOrUpdate(recipient)); |
| | | } |
| | | |
| | | /** |
| | | * 新增收货地址/修改收货地址 |
| | | */ |
| | |
| | | public R<String> addressDelete(@RequestParam String id) { |
| | | return R.ok(recipientService.removeById(id) ? "删除成功!" : "删除失败!"); |
| | | } |
| | | |
| | | /** |
| | | * 删除收货地址 |
| | | */ |
| | |
| | | |
| | | return R.ok(userId); |
| | | } |
| | | |
| | | @GetMapping("/getOrderAddress") |
| | | @ApiOperation(value = "获取修改订单收货地址", tags = {"学习端-获取修改订单收货地址"}) |
| | | public R<List<Recipient>> getOrderAddress() { |
| | |
| | | .eq("userId", tokenService.getLoginUserStudy().getUserid())); |
| | | return R.ok(userId); |
| | | } |
| | | |
| | | @GetMapping("/updateOrderAddressParent") |
| | | @ApiOperation(value = "修改订单收货地址", tags = {"家长端-修改订单收货地址"}) |
| | | @ApiImplicitParams({ |
| | |
| | | orderService.updateById(byId); |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @GetMapping("/updateOrderAddress") |
| | | @ApiOperation(value = "修改订单收货地址", tags = {"学习端-修改订单收货地址"}) |
| | | public R updateOrderAddress(@RequestParam Integer orderId,@RequestParam Integer recipientId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取所有商品分类 |
| | | */ |
| | | @GetMapping("/goodTypeStudy") |
| | | @ApiOperation(value = "学习端-商品分类列表", tags = {"学习端-商品分类列表"}) |
| | | public R<List<TGoodsType>> goodTypeStudy() { |
| | | return R.ok(goodsTypeService.lambdaQuery().eq(TGoodsType::getIsDelete, 0).eq(TGoodsType::getIsDelete, 0).list()); |
| | | } |
| | | |
| | | /** |
| | | * 商品详情 |
| | | * |
| | | * @param goodId 商品id |
| | |
| | | int number = goods.getBasicCount() + orderService.getGoodBuyNumber(goods.getId()); |
| | | return R.ok(new GoodDetailVO(goods, goodsTypes, number)); |
| | | } |
| | | |
| | | /** |
| | | * 商品详情 |
| | | * |
| | |
| | | goodDetailVO.setOrderNumber(orderNumber); |
| | | return R.ok(goodDetailVO); |
| | | } |
| | | |
| | | /** |
| | | * 商城-立即兑换 |
| | | */ |
| | |
| | | Recipient recipient = recipientService.getById(goodExchange.getRecipientId()); |
| | | return goodsService.goodExchange1(goodExchange, recipient); |
| | | } |
| | | |
| | | @PostMapping("/goodExchangeStudy") |
| | | @ApiOperation(value = "学习端-商品兑换确认", tags = {"学习端-商品兑换确认"}) |
| | | public R goodExchangeStudy(@RequestBody GoodExchangeDTO goodExchange) { |
| | |
| | | |
| | | @Autowired |
| | | private StudyClient studyClient; |
| | | |
| | | @PostMapping("/getOrderInfo/{id}") |
| | | @ApiOperation(value = "查看详情", tags = {"后台-订单管理"}) |
| | | public R<TOrderVO> getOrderInfo(@PathVariable("id")Integer id) { |
| | |
| | | tGoodsVO.setPhone(byId1.getPhone()); |
| | | return R.ok(tGoodsVO); |
| | | } |
| | | |
| | | @PostMapping("/confirm1") |
| | | @ApiOperation(value = "确认发货", tags = {"后台-订单管理"}) |
| | | public R getGoodsInfo1(@RequestBody OrderDTO dto) { |
| | |
| | | orderService.updateById(byId); |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PostMapping("/listAll1") |
| | | @ApiOperation(value = "列表查询", tags = {"后台-订单管理"}) |
| | | public R<PageInfo<TOrderVO>> listAll1(@RequestBody OrderQuery query) throws ParseException { |