소스 검색

feat:自提商品

caoliqin 5 일 전
부모
커밋
bb4190e968

+ 96 - 0
fs-admin/src/main/java/com/fs/hisStore/controller/FsPickupGoodsController.java

@@ -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));
+    }
+}

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsStoreProductScrm.java

@@ -390,6 +390,9 @@ public class FsStoreProductScrm extends BaseEntity
 //    @Excel(name = "标签信息")
     private String tagInfo;
 
+    /** 是否自提商品 0否 1是 */
+    private Integer isPickup;
+
     /** 商品类型多选查询(用于IN查询) */
     private List<Integer> productTypes;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -160,6 +160,9 @@ public interface FsStoreProductScrmMapper
             "<foreach collection='maps.excludeProductIds'  item='item' index='index'  open='(' separator=',' close=')'> " +
             " #{item} </foreach>" +
             "</if>" +
+            "<if test = 'maps.isPickup != null '> " +
+            "and p.is_pickup = #{maps.isPickup} " +
+            "</if>" +
             " order by p.product_id desc "+
             "</script>"})
     List<FsStoreProductListVO> selectFsStoreProductListVO(@Param("maps") FsStoreProductScrm fsStoreProduct);
@@ -170,6 +173,7 @@ public interface FsStoreProductScrmMapper
             " p.ot_price,p.agent_price, p.postage,p.unit_name,p.sort,p.sales,p.stock,p.is_show,p.is_hot,p.is_benefit,p.is_best,p.is_new,p.description,p.create_time,p.update_time,p.is_postage,p.is_del,p.give_integral," +
             " p.cost,p.is_good,p.browse,p.code_path,p.temp_id,p.spec_type,p.is_integral,p.integral,p.product_type,p.prescribe_code, p.prescribe_spec,p.prescribe_factory,p.prescribe_name,p.is_display,p.tui_cate_id " +
             " FROM fs_store_product_scrm p LEFT JOIN fs_store_product_attr_value_scrm ave on p.product_id=ave.product_id  WHERE ave.bar_code != '' and p.product_id is not null" +
+            "<if test = 'maps.isPickup != null '> and p.is_pickup = #{maps.isPickup} </if>" +
             ") p left join fs_store_product_category_scrm pc on p.cate_id=pc.cate_id   " +
             " where 1=1 " +
             "<if test = 'maps.productName != null and  maps.productName !=\"\"  '> " +

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreProductAddEditParam.java

@@ -311,4 +311,7 @@ public class FsStoreProductAddEditParam implements Serializable
     private List<Long> tagIds;
 
     private String tagInfo;
+
+    /** 是否自提商品 0否 1是 */
+    private Integer isPickup;
 }

+ 6 - 1
fs-service/src/main/resources/mapper/hisStore/FsStoreProductScrmMapper.xml

@@ -82,6 +82,7 @@
         <result property="activityStartTime"    column="activity_start_time"    />
         <result property="activityEndTime"    column="activity_end_time"    />
         <result property="tagInfo"    column="tag_info"    />
+        <result property="isPickup"    column="is_pickup"    />
     </resultMap>
 
     <sql id="selectFsStoreProductVo">
@@ -93,7 +94,7 @@
                is_display,tui_cate_id,company_ids,is_drug,drug_image,drug_reg_cert_no,common_name,dosage_form,
                unit_price,batch_number,mah,mah_address,manufacturer,manufacturer_address,indications,dosage,
                adverse_reactions,contraindications,precautions,is_audit,store_id,return_address,brand,food_production_license_code,
-               origin_place,net_content,shelf_life,domestic_imported,app_ids,purchase_limit,single_purchase_limit,activity_type,activity_start_time,activity_end_time,tag_info
+               origin_place,net_content,shelf_life,domestic_imported,app_ids,purchase_limit,single_purchase_limit,activity_type,activity_start_time,activity_end_time,tag_info,is_pickup
         from fs_store_product_scrm
     </sql>
 
@@ -186,6 +187,7 @@
             <if test="netContent != null and netContent != ''">and net_content = #{netContent} </if>
             <if test="shelfLife != null">and shelf_life = #{shelfLife} </if>
             <if test="domesticImported != null and domesticImported != ''">and domestic_imported = #{domesticImported} </if>
+            <if test="isPickup != null">and is_pickup = #{isPickup}</if>
         </where>
     </select>
 
@@ -293,6 +295,7 @@
             <if test="singlePurchaseLimit != null">single_purchase_limit,</if>
             <if test="activityType != null">activity_type,</if>
             <if test="tagInfo != null and tagInfo != ''">tag_info,</if>
+            <if test="isPickup != null">is_pickup,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null and image != ''">#{image},</if>
@@ -369,6 +372,7 @@
             <if test="singlePurchaseLimit != null">#{singlePurchaseLimit},</if>
             <if test="activityType != null">#{activityType},</if>
             <if test="tagInfo != null and tagInfo != ''">#{tagInfo},</if>
+            <if test="isPickup != null">#{isPickup},</if>
         </trim>
     </insert>
 
@@ -450,6 +454,7 @@
             <if test="activityType != null">activity_type = #{activityType},</if>
             <if test="tagInfo != null and tagInfo != ''">tag_info = #{tagInfo},</if>
             <if test="tagInfo == null or tagInfo == ''">tag_info = #{tagInfo},</if>
+            <if test="isPickup != null">is_pickup = #{isPickup},</if>
         </trim>
         where product_id = #{productId}
     </update>