| | |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "添加", tags = {"后台-商品管理"}) |
| | | public R addGoods(@RequestBody TGoods dto) { |
| | | if (dto.getTotal()!=null){ |
| | | dto.setSurplus(dto.getTotal()); |
| | | }else{ |
| | | dto.setSurplus(0); |
| | | } |
| | | goodsService.save(dto); |
| | | return R.ok("添加成功"); |
| | | } |
| | |
| | | @PostMapping("/updateGoods") |
| | | @ApiOperation(value = "修改", tags = {"后台-商品管理"}) |
| | | public R updateGoods(@RequestBody TGoods dto) { |
| | | if (dto.getTotal()!=null){ |
| | | dto.setSurplus(dto.getTotal()); |
| | | }else{ |
| | | dto.setSurplus(0); |
| | | } |
| | | goodsService.updateById(dto); |
| | | return R.ok("修改成功"); |
| | | } |
| | |
| | | @PostMapping("/goodExchange") |
| | | @ApiOperation(value = "家长端-商品兑换确认", tags = {"家长端-商品兑换确认"}) |
| | | public R goodExchange(@RequestBody GoodExchangeDTO goodExchange) { |
| | | System.err.println("家长兑换:"); |
| | | Recipient recipient = recipientService.getById(Integer.valueOf(goodExchange.getRecipientId())); |
| | | return goodsService.goodExchange1(goodExchange, recipient); |
| | | } |
| | |
| | | @ApiOperation(value = "商品兑换确认", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 42) |
| | | public R<String> goodExchangeStudy(@RequestBody @Validated GoodExchangeDTO goodExchange) { |
| | | System.err.println("学习兑换:"); |
| | | Recipient recipient = recipientService.getById(goodExchange.getRecipientId()); |
| | | return goodsService.goodExchange(goodExchange, recipient); |
| | | } |