| | |
| | | package com.xzx.gc.shop.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/addGoods.json") |
| | | @ApiOperation(value = "商品管理-添加商品", notes = "test: 仅0有正确返回") |
| | | public JsonResult<String> addGoods(@RequestBody AddGoodsDto model, HttpServletRequest request) { |
| | | |
| | | List<ScoreGoodsStyleDto> scoreGoodsStyles = model.getScoreGoodsStyles(); |
| | | if(CollUtil.isNotEmpty(scoreGoodsStyles)){ |
| | | return JsonResult.failMessage("样式不能为空!"); |
| | | } |
| | | model.setCreatedBy(getAdminName(request)); |
| | | model.setCreatedTime(new Date()); |
| | | Long scoreGoodsId = goodsService.addGoods(model); |
| | |
| | | if(ScoreGoods.ISSALE_YES == isSale){ |
| | | return JsonResult.failMessage("请先下架商品!"); |
| | | } |
| | | List<ScoreGoodsStyleDto> scoreGoodsStyles = model.getScoreGoodsStyles(); |
| | | if(CollUtil.isNotEmpty(scoreGoodsStyles)){ |
| | | return JsonResult.failMessage("样式不能为空!"); |
| | | } |
| | | goodsService.updateGoods(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-更新商品-" + id).build(); |