فهرست منبع

新增店铺端一键入库到自己商品列表

Guos 3 هفته پیش
والد
کامیت
794f0b99f3

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

@@ -573,4 +573,9 @@ public class FsStoreProductScrm extends BaseEntity {
      * 器械编号
      * **/
     private String medicalDeviceCode;
+
+    /**
+     * 平台商品id
+     * **/
+    private Long platformProductId;
 }

+ 7 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsPlatformProductScrmService.java

@@ -53,4 +53,11 @@ public interface IFsPlatformProductScrmService {
      * @return
      */
     R addOrEdit(FsPlatFormProductAddEditParam fsStoreProduct);
+
+    /**
+     * 总后台总库商品一键加入到自己的店铺去
+     * @param fsStoreProduct
+     * @return  R
+     */
+    R oneClickStorage(FsPlatFormProductAddEditParam fsStoreProduct);
 }

+ 49 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsPlatformProductScrmServiceImpl.java

@@ -65,6 +65,10 @@ public class FsPlatformProductScrmServiceImpl implements IFsPlatformProductScrmS
     @Autowired
     private FsStoreProductGroupScrmMapper fsStoreProductGroupMapper;
 
+    @Autowired
+    private FsStoreProductScrmMapper fsStoreProductMapper;
+
+
 
     /**
      * 查询商品列表
@@ -246,6 +250,51 @@ public class FsPlatformProductScrmServiceImpl implements IFsPlatformProductScrmS
         return R.ok();
     }
 
+    /**
+     * 总后台总库商品一键加入到自己的店铺去
+     * @param fsStoreProduct
+     * @return  R
+     */
+    @Override
+    public R oneClickStorage(FsPlatFormProductAddEditParam fsStoreProduct) {
+        //获取复制商品信息
+        FsPlatformProductScrm copyProductInfo = fsPlatformProductScrmMapper.selectFsPlatformProductById(fsStoreProduct.getProductId());
+        if(copyProductInfo==null){
+            return R.error("复制,商品数据不存在!");
+        }
+        //插入复制商品
+        Long platformProductId = copyProductInfo.getProductId();
+        FsStoreProductScrm fsStoreProductScrm = new FsStoreProductScrm();
+        BeanUtils.copyProperties(copyProductInfo, fsStoreProductScrm); //copy
+        fsStoreProductScrm.setProductId(null);
+        fsStoreProductScrm.setIsShow(0);//下架状态
+        fsStoreProductScrm.setIsAudit("0");//未审核状态
+        fsStoreProductScrm.setCreateTime(new Date());
+        fsStoreProductScrm.setUpdateTime(new Date());
+        fsStoreProductScrm.setPlatformProductId(platformProductId);
+        fsStoreProductScrm.setStoreId(fsStoreProduct.getStoreId());
+        int insertRowNum = fsStoreProductMapper.insertFsStoreProduct(fsStoreProductScrm);
+        boolean flag = insertRowNum > 0;
+        if(flag){
+            Long productId = fsStoreProductScrm.getProductId();
+            //复制规格
+            List<FsStoreProductAttrScrm> fsStoreProductAttrScrms = fsStoreProductAttrMapper.selectFsStoreProductAttrByProductId(platformProductId);
+            for (FsStoreProductAttrScrm fsStoreProductAttrScrm : fsStoreProductAttrScrms){
+                fsStoreProductAttrScrm.setId(null);
+                fsStoreProductAttrScrm.setProductId(productId);
+                fsStoreProductAttrMapper.insertFsStoreProductAttr(fsStoreProductAttrScrm);
+            }
+            List<FsStoreProductAttrValueScrm> fsStoreProductAttrValueScrms = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(platformProductId);
+            for (FsStoreProductAttrValueScrm fsStoreProductAttrValueScrm : fsStoreProductAttrValueScrms){
+                fsStoreProductAttrValueScrm.setId(null);
+                fsStoreProductAttrValueScrm.setProductId(productId);
+                fsStoreProductAttrValueScrm.setStoreId(fsStoreProduct.getStoreId());
+                fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(fsStoreProductAttrValueScrm);
+            }
+        }
+        return flag?R.ok():R.error("添加失败!");
+    }
+
     private void handleProductAttributes(FsPlatFormProductAddEditParam param, FsPlatformProductScrm product, Long storeId) {
         if (param.getSpecType().equals(0)) {
             ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()

+ 5 - 2
fs-service/src/main/resources/mapper/hisStore/FsPlatformProductScrmMapper.xml

@@ -91,6 +91,7 @@
         <result property="isLicensePermanent" column="is_license_permanent"/>
         <result property="isCertificatePermanent" column="is_certificate_permanent"/>
         <result property="isGmpAuthPermanent" column="is_gmp_auth_permanent"/>
+        <result property="storeProductId" column="store_product_id"/>
     </resultMap>
 
     <sql id="selectFsPlatFormProductVo">
@@ -107,7 +108,7 @@
                certificate, certificate_start, certificate_end,
                voucher, voucher_start, voucher_end,
                gmp_auth, gmp_auth_start, gmp_auth_end,business_link,medical_device_code,
-               is_business_permanent,is_license_permanent,is_certificate_permanent,is_gmp_auth_permanent
+               is_business_permanent,is_license_permanent,is_certificate_permanent,is_gmp_auth_permanent, store_product_id
         from fs_platform_product_scrm
     </sql>
 
@@ -120,7 +121,7 @@
        p.is_display,p.tui_cate_id,p.company_ids,p.is_drug,p.drug_image,p.drug_reg_cert_no,p.common_name,p.dosage_form,
        p.unit_price,p.batch_number,p.mah,p.mah_address,p.manufacturer,p.manufacturer_address,p.indications,p.ingredient,p.dosage,
        p.adverse_reactions,p.contraindications,p.precautions,p.is_audit,p.store_id,
-       p.is_business_permanent,p.is_license_permanent,p.is_certificate_permanent,p.is_gmp_auth_permanent
+       p.is_business_permanent,p.is_license_permanent,p.is_certificate_permanent,p.is_gmp_auth_permanent,store_product_id
     </sql>
 
     <select id="selectList" resultType="com.fs.hisStore.vo.FsPlatformProductListVO">
@@ -388,6 +389,7 @@
             <if test="isLicensePermanent != null">is_license_permanent ,</if>
             <if test="isCertificatePermanent != null">is_certificate_permanent ,</if>
             <if test="isGmpAuthPermanent != null">is_gmp_auth_permanent ,</if>
+            <if test="storeProductId != null">store_product_id ,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="productId != null and productId != ''">#{productId},</if>
@@ -480,6 +482,7 @@
             <if test="isLicensePermanent != null">#{isLicensePermanent} ,</if>
             <if test="isCertificatePermanent != null">#{isCertificatePermanent} ,</if>
             <if test="isGmpAuthPermanent != null">#{isGmpAuthPermanent} ,</if>
+            <if test="storeProductId != null">#{storeProductId} ,</if>
         </trim>
     </insert>
 

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

@@ -91,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isLicensePermanent" column="is_license_permanent"/>
         <result property="isCertificatePermanent" column="is_certificate_permanent"/>
         <result property="isGmpAuthPermanent" column="is_gmp_auth_permanent"/>
+        <result property="platformProductId" column="platform_product_id"/>
     </resultMap>
 
     <sql id="selectFsStoreProductVo">
@@ -107,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                certificate, certificate_start, certificate_end,
                voucher, voucher_start, voucher_end,
                gmp_auth, gmp_auth_start, gmp_auth_end,business_link,medical_device_code,
-               is_business_permanent,is_license_permanent,is_certificate_permanent,is_gmp_auth_permanent
+               is_business_permanent,is_license_permanent,is_certificate_permanent,is_gmp_auth_permanent,platform_product_id
                from fs_store_product_scrm
     </sql>
 
@@ -120,9 +121,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                p.is_display,p.tui_cate_id,p.company_ids,p.is_drug,p.drug_image,p.drug_reg_cert_no,p.common_name,p.dosage_form,
                p.unit_price,p.batch_number,p.mah,p.mah_address,p.manufacturer,p.manufacturer_address,p.indications,p.ingredient,p.dosage,
                p.adverse_reactions,p.contraindications,p.precautions,p.is_audit,p.store_id,p.medical_device_code,
-               p.is_business_permanent,p.is_license_permanent,p.is_certificate_permanent,p.is_gmp_auth_permanent
+               p.is_business_permanent,p.is_license_permanent,p.is_certificate_permanent,p.is_gmp_auth_permanent,p.platform_product_id
         from fs_store_product_scrm p
-        select product_id, video, image, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, agent_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name, is_display, tui_cate_id, company_ids, store_id, 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 from fs_store_product_scrm
+        select product_id, video, image, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, agent_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name, is_display, tui_cate_id, company_ids, store_id, 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, platform_product_id from fs_store_product_scrm
     </sql>
 
     <select id="selectFsStoreProductByProductId" parameterType="Long" resultMap="FsStoreProductResult">
@@ -312,6 +313,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isLicensePermanent != null">is_license_permanent ,</if>
             <if test="isCertificatePermanent != null">is_certificate_permanent ,</if>
             <if test="isGmpAuthPermanent != null">is_gmp_auth_permanent ,</if>
+            <if test="platformProductId != null">platform_product_id ,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null and image != ''">#{image},</if>
@@ -403,6 +405,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isLicensePermanent != null">#{isLicensePermanent} ,</if>
             <if test="isCertificatePermanent != null">#{isCertificatePermanent} ,</if>
             <if test="isGmpAuthPermanent != null">#{isGmpAuthPermanent} ,</if>
+            <if test="platformProductId != null">#{platformProductId} ,</if>
          </trim>
     </insert>
 

+ 128 - 0
fs-store/src/main/java/com/fs/hisStore/controller/store/FsPlatformProductScrmController.java

@@ -0,0 +1,128 @@
+package com.fs.hisStore.controller.store;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+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.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.hisStore.domain.FsPlatformProductScrm;
+import com.fs.hisStore.domain.FsStoreProductAttrScrm;
+import com.fs.hisStore.domain.StoreLoginUserScrm;
+import com.fs.hisStore.param.FsPlatFormProductAddEditParam;
+import com.fs.hisStore.service.IFsPlatformProductScrmService;
+import com.fs.hisStore.service.IFsStoreProductAttrScrmService;
+import com.fs.hisStore.utils.UserUtil;
+import com.fs.hisStore.vo.FsPlatformProductListVO;
+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;
+
+/**
+ * @description: 总平台商品库
+ * @author: Guos
+ * @time: 2025/12/16 下午2:13
+ */
+@Slf4j
+@RestController
+@RequestMapping("/store/store/platformProduct")
+public class FsPlatformProductScrmController extends BaseController {
+
+    @Autowired
+    private IFsPlatformProductScrmService fsPlatformProductService;
+
+    @Autowired
+    private IFsStoreProductAttrScrmService attrService;
+
+
+    /**
+     * 总后台总库商品一键加入到自己的店铺去
+     * @param fsStoreProduct
+     * @return  R
+     */
+    @Log(title = "总后台商品总库协议过期提醒", businessType = BusinessType.OTHERe)
+    @PostMapping("/oneClickStorage")
+    public R oneClickStorage(@RequestBody FsPlatFormProductAddEditParam fsStoreProduct) {
+        StoreLoginUserScrm loginUser = UserUtil.getLoginUser();
+        fsStoreProduct.setStoreId(loginUser.getFsStore().getStoreId());
+        return fsPlatformProductService.oneClickStorage(fsStoreProduct);
+    }
+
+    /**
+     * 总后台商品总库协议过期提醒
+     * @return
+     */
+    @Log(title = "总后台商品总库协议过期提醒", businessType = BusinessType.OTHERe)
+    @GetMapping("/productNoticeInfo")
+    public R getProductNoticeInfo() {
+        List<String> productNoticeInfo = fsPlatformProductService.getProductNoticeInfo();
+        if (CollectionUtils.isEmpty(productNoticeInfo)) {return R.ok().put("code", 0);}
+        return R.ok().put("code", 200).put("data", productNoticeInfo);
+    }
+
+    /**
+     * 查询商品列表
+     * @param vo
+     * @return TableDataInfo
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(FsPlatformProductScrm vo) {
+        startPage();
+        List<FsPlatformProductListVO> list = fsPlatformProductService.selectList(vo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取商品详细信息
+     * @param productId
+     */
+    @GetMapping(value = "/{productId}")
+    public R getInfo(@PathVariable("productId") Long productId) {
+        FsPlatformProductScrm product = fsPlatformProductService.selectFsPlatformProductById(productId);
+        List<FsStoreProductAttrScrm> attrs = attrService.selectFsStoreProductAttrByProductId(productId);
+        return R.ok().put("data", product).put("attrs", attrs);
+    }
+
+    /**
+     * 商品复制
+     * @param product 商品对象
+     * @return R
+     * */
+    @PreAuthorize("@ss.hasPermi('his:storeProduct:copyProduct')")
+    @PostMapping("/copyProduct")
+    @Log(title = "复制商品", businessType = BusinessType.INSERT, isStoreLog = true, logParam = {"商品", "复制商品"})
+    public R copyProduct(@RequestBody FsPlatformProductScrm product) {
+        return fsPlatformProductService.copyProduct(product);
+    }
+
+    /**
+     * 新增或修改商品
+     * @param fsStoreProduct 商品对象
+     * @return R
+     * */
+    @PreAuthorize("@ss.hasPermi('store:storeProduct:add')")
+    @Log(title = "商品管理", businessType = BusinessType.INSERT, businessTypeExpression = "#p0.getProductId()>0? T(com.fs.common.enums.BusinessType).UPDATE: T(com.fs.common.enums.BusinessType).INSERT"
+            , isStoreLog = true, logParamExpression = "#p0.getProductId()>0? new String[]{'商品','修改商品'}: new String[]{'商品','新增商品'}")
+    @PostMapping(value = "/addOrEdit")
+    public R addOrEdit(@RequestBody FsPlatFormProductAddEditParam fsStoreProduct) {
+        if (ObjectUtils.isNotNull(fsStoreProduct.getIsShow())) {
+            if (fsStoreProduct.getIsShow() == 1) {
+                logger.info("商品上架:{}", fsStoreProduct.getProductName() + new Date());
+            }
+        }
+
+        if (ObjectUtils.isNotNull(fsStoreProduct.getIsDisplay())) {
+            if (fsStoreProduct.getIsDisplay() == 1) {
+                logger.info("商品前端展示:{}", fsStoreProduct.getProductName() + new Date());
+            }
+        }
+        return fsPlatformProductService.addOrEdit(fsStoreProduct);
+    }
+
+
+}