|
|
@@ -0,0 +1,96 @@
|
|
|
+package com.fs.hisStore.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
|
+import com.fs.hisStore.param.FsStoreProductAddEditParam;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
|
+import com.fs.hisStore.vo.FsStoreProductListVO;
|
|
|
+import com.mysql.cj.util.StringUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 自提商品Controller
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/store/store/pickupGoods")
|
|
|
+public class FsPickupGoodsController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductScrmService fsStoreProductService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductAttrValueScrmService attrValueService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询自提商品列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:pickupGoods:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(FsStoreProductScrm fsStoreProduct) {
|
|
|
+ startPage();
|
|
|
+ fsStoreProduct.setIsDel(0);
|
|
|
+ fsStoreProduct.setIsPickup(1);
|
|
|
+ List<FsStoreProductListVO> list;
|
|
|
+ if (StringUtils.isNullOrEmpty(fsStoreProduct.getBarCode())) {
|
|
|
+ list = fsStoreProductService.selectFsStoreProductListVO(fsStoreProduct);
|
|
|
+ } else {
|
|
|
+ list = fsStoreProductService.selectFsStoreProductBarCodeListVO(fsStoreProduct);
|
|
|
+ }
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取自提商品详情
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:pickupGoods:query')")
|
|
|
+ @GetMapping("/{productId}")
|
|
|
+ public R getInfo(@PathVariable("productId") Long productId) {
|
|
|
+ FsStoreProductScrm product = fsStoreProductService.selectFsStoreProductById(productId);
|
|
|
+ FsStoreProductAttrValueScrm query = new FsStoreProductAttrValueScrm();
|
|
|
+ query.setProductId(productId);
|
|
|
+ List<FsStoreProductAttrValueScrm> values = attrValueService.selectFsStoreProductAttrValueList(query);
|
|
|
+ return R.ok().put("data", product).put("values", values);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或修改自提商品
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:pickupGoods:add') or @ss.hasPermi('store:pickupGoods:edit')")
|
|
|
+ @Log(title = "自提商品", businessType = BusinessType.INSERT, businessTypeExpression = "#p0.getProductId()>0? T(com.fs.common.enums.BusinessType).UPDATE: T(com.fs.common.enums.BusinessType).INSERT")
|
|
|
+ @PostMapping("/addOrEdit")
|
|
|
+ public R addOrEdit(@RequestBody FsStoreProductAddEditParam fsStoreProduct) {
|
|
|
+ if (ObjectUtils.isNotNull(fsStoreProduct.getIsShow()) && fsStoreProduct.getIsShow() == 1) {
|
|
|
+ log.info("自提商品上架:{}{}", fsStoreProduct.getProductName(), new Date());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(fsStoreProduct.getIsDisplay()) && fsStoreProduct.getIsDisplay() == 1) {
|
|
|
+ log.info("自提商品前端展示:{}{}", fsStoreProduct.getProductName(), new Date());
|
|
|
+ }
|
|
|
+ fsStoreProduct.setIsPickup(1);
|
|
|
+ return fsStoreProductService.addOrEdit(fsStoreProduct);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除自提商品
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:pickupGoods:remove')")
|
|
|
+ @Log(title = "自提商品", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{productIds}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] productIds) {
|
|
|
+ return toAjax(fsStoreProductService.deleteFsStoreProductByIds(productIds));
|
|
|
+ }
|
|
|
+}
|