| | |
| | | } |
| | | GroupBuyProductPo groupBuyProductPo = BeanConvertUtil.covertBean(reqJson, GroupBuyProductPo.class); |
| | | groupBuyProductPo.setStoreId(storeId); |
| | | return saveGroupBuyProductBMOImpl.save(groupBuyProductPo,groupBuyProductSpecPos); |
| | | return saveGroupBuyProductBMOImpl.save(groupBuyProductPo, groupBuyProductSpecPos); |
| | | } |
| | | |
| | | /** |
| | |
| | | Assert.hasKeyAndValue(reqJson, "sort", "请求报文中未包含sort"); |
| | | Assert.hasKeyAndValue(reqJson, "groupId", "groupId不能为空"); |
| | | |
| | | Assert.hasKey(reqJson, "productSpecs", "请求报文中未包含商品规格信息"); |
| | | |
| | | JSONArray productSpecs = reqJson.getJSONArray("productSpecs"); |
| | | |
| | | if (productSpecs.size() < 1) { |
| | | throw new IllegalArgumentException("请求报文中商品规格数量为0"); |
| | | } |
| | | List<GroupBuyProductSpecPo> groupBuyProductSpecPos = new ArrayList<>(); |
| | | GroupBuyProductSpecPo groupBuyProductSpecPo = null; |
| | | for (int specIndex = 0; specIndex < productSpecs.size(); specIndex++) { |
| | | groupBuyProductSpecPo = BeanConvertUtil.covertBean(productSpecs.getJSONObject(specIndex), GroupBuyProductSpecPo.class); |
| | | groupBuyProductSpecPo.setProductId(reqJson.getString("productId")); |
| | | groupBuyProductSpecPo.setDefaultShow("F"); |
| | | groupBuyProductSpecPo.setGroupSales("1"); |
| | | groupBuyProductSpecPo.setStoreId(storeId); |
| | | groupBuyProductSpecPos.add(groupBuyProductSpecPo); |
| | | } |
| | | GroupBuyProductPo groupBuyProductPo = BeanConvertUtil.covertBean(reqJson, GroupBuyProductPo.class); |
| | | groupBuyProductPo.setStoreId(storeId); |
| | | return updateGroupBuyProductBMOImpl.update(groupBuyProductPo); |
| | | return updateGroupBuyProductBMOImpl.update(groupBuyProductPo, groupBuyProductSpecPos); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/queryGroupBuyProduct", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryGroupBuyProduct(@RequestHeader(value = "store-id") String storeId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | @RequestParam(value = "row") int row, |
| | | @RequestParam(value = "groupId", required = false) String groupId) { |
| | | GroupBuyProductDto groupBuyProductDto = new GroupBuyProductDto(); |
| | | groupBuyProductDto.setPage(page); |
| | | groupBuyProductDto.setRow(row); |
| | | groupBuyProductDto.setStoreId(storeId); |
| | | groupBuyProductDto.setGroupId(groupId); |
| | | return getGroupBuyProductBMOImpl.get(groupBuyProductDto); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/queryGroupBuyBatch", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryGroupBuyBatch(@RequestHeader(value = "store-id") String storeId, |
| | | @RequestParam(value = "batchId",required = false) String batchId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | GroupBuyBatchDto groupBuyBatchDto = new GroupBuyBatchDto(); |
| | | groupBuyBatchDto.setPage(page); |
| | | groupBuyBatchDto.setRow(row); |
| | | groupBuyBatchDto.setStoreId(storeId); |
| | | groupBuyBatchDto.setBatchId(batchId); |
| | | return getGroupBuyBatchBMOImpl.get(groupBuyBatchDto); |
| | | } |
| | | } |