diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketProductController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketProductController.java index ec9724c..ad74017 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketProductController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketProductController.java @@ -45,6 +45,7 @@ public class SupermarketProductController extends BaseController { @GetMapping("/list") public TableDataInfo list(SupermarketProduct supermarketProduct) { startPage(); + System.out.println(supermarketProduct.getMaterialName()); List list = supermarketProductService.selectSupermarketProductList(supermarketProduct); return getDataTable(list); } @@ -78,9 +79,9 @@ public class SupermarketProductController extends BaseController { */ @ApiOperation(value = "获取超市商城商品详细信息") //@RequiresPermissions("supermarket:product:query") - @GetMapping(value = "/{productId}") - public AjaxResult getInfo(@PathVariable("productId") Long productId) { - return success(supermarketProductService.selectSupermarketProductByProductId(productId)); + @PostMapping(value = "/getInfo") + public AjaxResult getInfo(@RequestBody SupermarketProduct supermarketProduct) { + return success(supermarketProductService.selectSupermarketProductByProductId(supermarketProduct.getProductId())); } /** @@ -89,7 +90,7 @@ public class SupermarketProductController extends BaseController { @ApiOperation(value = "新增超市商城商品") //@PreventRepeatSubmit //@RequiresPermissions("supermarket:product:add") - @SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增超市商城商品") + @SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->新增超市商城商品") @PostMapping public AjaxResult add(@RequestBody SupermarketProduct supermarketProduct) { try { @@ -98,7 +99,50 @@ public class SupermarketProductController extends BaseController { return error(e.getMessage()); } } - + /** + * 新增超市商城商品 + */ + @ApiOperation(value = "新增超市商城商品") + //@PreventRepeatSubmit + //@RequiresPermissions("supermarket:product:add") + @SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->新增超市商城商品") + @PostMapping("/addProducts") + public AjaxResult adds(@RequestBody SupermarketProduct supermarketProduct) { + try { + return toAjax(supermarketProductService.insertSupermarketProducts(supermarketProduct)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + /** + * 新增超市商城商品 + */ + @ApiOperation(value = "删除超市商城商品") + //@PreventRepeatSubmit + //@RequiresPermissions("supermarket:product:add") + @SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->删除超市商城商品") + @PostMapping("/delProduct") + public AjaxResult delProduct(@RequestBody SupermarketProduct supermarketProduct) { + try { + String[] productIds=supermarketProduct.getProductIds().split(","); + return toAjax(supermarketProductService.deleteSupermarketProductByProductIdss(productIds)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + @ApiOperation(value = "超市商城商品批量上线") + //@PreventRepeatSubmit + //@RequiresPermissions("supermarket:product:add") + @SysLog(title = "超市商城商品批量上线", businessType = OperaType.INSERT, logType = 1,module = "超市管理->超市商城商品批量上线") + @PostMapping("/onlines") + public AjaxResult online(@RequestBody SupermarketProduct supermarketProduct) { + try { + String[] productIds=supermarketProduct.getProductIds().split(","); + return toAjax(supermarketProductService.onlineSupermarketProductByProductIdss(productIds)); + } catch (Exception e) { + return error(e.getMessage()); + } + } /** * 修改超市商城商品 */ @@ -109,6 +153,8 @@ public class SupermarketProductController extends BaseController { @PostMapping("/edit") public AjaxResult edit(@RequestBody SupermarketProduct supermarketProduct) { try { + System.out.println(supermarketProduct.getPutawayState()); + System.out.println(supermarketProduct.getIfOnline()); return toAjax(supermarketProductService.updateSupermarketProduct(supermarketProduct)); } catch (Exception e) { return error(e.getMessage()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketProduct.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketProduct.java index 28858f5..5c138c4 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketProduct.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketProduct.java @@ -74,6 +74,8 @@ public class SupermarketProduct extends BaseEntity { @ApiModelProperty(value = "库存数") private BigDecimal inventoryNum; + private String materialIds; + private String materialName; private String materialType; @@ -85,7 +87,8 @@ public class SupermarketProduct extends BaseEntity { private String areaName; private String unitName; - + private String productIds; + private String barCode; public String getImgUrl() { return FileUrlUtil.getFileUrl(this.imgUrl); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java index e524bc8..7458cb5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java @@ -60,4 +60,6 @@ public interface SupermarketProductMapper { * @return 结果 */ public int deleteSupermarketProductByProductIds(Long[] productIds); + public int deleteSupermarketProductByProductIdss(String[] productIds); + public int onlineSupermarketProductByProductIdss(String[] productIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/ISupermarketProductService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/ISupermarketProductService.java index 72da950..dbc3375 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/ISupermarketProductService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/ISupermarketProductService.java @@ -36,6 +36,7 @@ public interface ISupermarketProductService { */ public int insertSupermarketProduct(SupermarketProduct supermarketProduct); + public int insertSupermarketProducts(SupermarketProduct supermarketProduct); /** * 修改超市商城商品 * @@ -51,7 +52,8 @@ public interface ISupermarketProductService { * @return 结果 */ public int deleteSupermarketProductByProductIds(Long[] productIds); - + public int deleteSupermarketProductByProductIdss(String[] productIds); + public int onlineSupermarketProductByProductIdss(String[] productIds); /** * 删除超市商城商品信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketProductServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketProductServiceImpl.java index 5edba79..87d1311 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketProductServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketProductServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.canteen.core.supermarket.service.impl; +import java.util.ArrayList; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; @@ -64,6 +65,22 @@ public class SupermarketProductServiceImpl implements ISupermarketProductService } } + @Override + public int insertSupermarketProducts(SupermarketProduct supermarketProduct) { + supermarketProduct.setCreateTime(DateUtils.getNowDate()); + supermarketProduct.setCreateBy(SecurityUtils.getUsername()); + try { + List sps=new ArrayList<>(); + sps=supermarketProductMapper.selectSupermarketAddProductList(supermarketProduct); + for(SupermarketProduct vo:sps){ + vo.setSupermarketId(supermarketProduct.getSupermarketId()); + supermarketProductMapper.insertSupermarketProduct(vo); + } + return 1; + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } /** * 修改超市商城商品 * @@ -91,7 +108,14 @@ public class SupermarketProductServiceImpl implements ISupermarketProductService public int deleteSupermarketProductByProductIds(Long[] productIds) { return supermarketProductMapper.deleteSupermarketProductByProductIds(productIds); } - + @Override + public int deleteSupermarketProductByProductIdss(String[] productIds) { + return supermarketProductMapper.deleteSupermarketProductByProductIdss(productIds); + } + @Override + public int onlineSupermarketProductByProductIdss(String[] productIds) { + return supermarketProductMapper.onlineSupermarketProductByProductIdss(productIds); + } /** * 删除超市商城商品信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml index 27493eb..47d2568 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml @@ -26,16 +26,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select sp.product_id, sp.supermarket_id, sp.material_id, sp.putaway_state, sp.if_online, sp.sale_price, sp.pref_price, sp.person_limit, sp.one_day_limit, sp.img_url, sp.inventory_num, sp.create_by, - sp.create_time, sp.update_by, sp.update_time, sm.material_name, spu.unit_name + sp.create_time, sp.update_by, sp.update_time, sm.material_name,smt.material_type_name, spu.unit_name from supermarket_product sp left join supermarket_material sm on sm.material_id = sp.material_id left join supply_product_unit spu on spu.unit_id = sm.unit_id + left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id