Pārlūkot izejas kodu

http://192.168.0.21/index.php?m=bug&f=view&bugID=25946
修改商品上下架逻辑

tianboguang 3 gadi atpakaļ
vecāks
revīzija
50a2667fe6

+ 4 - 1
platform-shop/src/main/java/com/platform/controller/GoodsController.java

@@ -449,8 +449,9 @@ public class GoodsController extends AbstractController{
     public Result enSale(@RequestBody String id) {
         for(String ids : id.split(",")){
             goodsService.enSale(Integer.parseInt(ids));
+            GoodsEntity entity = goodsService.queryObject(Integer.parseInt(ids));
+            sendDataToApi(entity);
         }
-
         return Result.success();
     }
 
@@ -462,6 +463,8 @@ public class GoodsController extends AbstractController{
     public Result unSale(@RequestBody String id) {
         for(String ids : id.split(",")){
             goodsService.unSale(Integer.parseInt(ids));
+            GoodsEntity entity = goodsService.queryObject(Integer.parseInt(ids));
+            sendDataToApi(entity);
         }
 
         return Result.success();

+ 0 - 52
platform-shop/src/main/java/com/platform/service/impl/GoodsServiceImpl.java

@@ -98,58 +98,6 @@ public class GoodsServiceImpl implements GoodsService {
         return goodsDao.queryTotalCustom(brandId, isDelete , sidx, order ,offset,limit);
     }
 
-//    @Override
-//    @Transactional
-//    public int save(GoodsEntity goods) {
-//        SysUserEntity user = ShiroUtils.getUserEntity();
-//        Map<String, Object> map = new HashMap<>();
-//        map.put("name", goods.getName());
-//        List<GoodsEntity> list = queryList(map);
-//        if (null != list && list.size() != 0) {
-//            throw new RRException("商品名称已存在!");
-//        }
-//        Integer id = goodsDao.queryMaxId() + 1;
-//        goods.setId(id);
-//
-//        //保存产品信息
-//        ProductEntity productEntity = new ProductEntity();
-//        productEntity.setGoodsId(id);
-//        productEntity.setGoodsSn(goods.getGoodsSn());
-//        productEntity.setGoodsNumber(goods.getGoodsNumber());
-//        productEntity.setRetailPrice(goods.getRetailPrice());
-//        productEntity.setMarketPrice(goods.getMarketPrice());
-//        productEntity.setGoodsSpecificationIds("");
-//        productDao.save(productEntity);
-//
-//        goods.setAddTime(new Date());
-//        goods.setPrimaryProductId(productEntity.getId());
-//
-//        //保存商品详情页面显示的属性
-//        List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
-//        if (null != attributeEntityList && attributeEntityList.size() > 0) {
-//            for (GoodsAttributeEntity item : attributeEntityList) {
-//                item.setGoodsId(id);
-//                goodsAttributeDao.save(item);
-//            }
-//        }
-//
-//        //商品轮播图
-//        List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
-//        if (null != galleryEntityList && galleryEntityList.size() > 0) {
-//            for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
-//                galleryEntity.setGoodsId(id);
-//                goodsGalleryDao.save(galleryEntity);
-//            }
-//        }
-//
-//        goods.setIsDelete(0);
-//        goods.setCreateUserDeptId(user.getDeptId());
-//        goods.setCreateUserId(user.getUserId());
-//        goods.setUpdateUserId(user.getUserId());
-//        goods.setUpdateTime(new Date());
-//        return goodsDao.save(goods);
-//    }
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int save(GoodsEntity goods) {