chenguo 1 тиждень тому
батько
коміт
35ff13dc0b

+ 94 - 0
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreRecommendScrmController.java

@@ -0,0 +1,94 @@
+package com.fs.hisStore.controller;
+
+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.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.hisStore.domain.FsStoreRecommendScrm;
+import com.fs.hisStore.service.IFsStoreRecommendScrmService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 店铺推荐Controller
+ *
+ * @author fs
+ * @date 2023-06-15
+ */
+@RestController
+@RequestMapping("/store/recommend")
+public class FsStoreRecommendScrmController extends BaseController
+{
+    @Autowired
+    private IFsStoreRecommendScrmService fsStoreRecommendService;
+
+    /**
+     * 查询店铺推荐列表
+     */
+    @PreAuthorize("@ss.hasPermi('store:recommend:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsStoreRecommendScrm fsStoreRecommendScrm)
+    {
+        startPage();
+        List<FsStoreRecommendScrm> list = fsStoreRecommendService.selectFsStoreRecommendScrmList(fsStoreRecommendScrm);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取店铺推荐详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('store:recommend:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsStoreRecommendService.selectFsStoreRecommendScrmById(id));
+    }
+
+    /**
+     * 新增店铺推荐
+     */
+    @PreAuthorize("@ss.hasPermi('store:recommend:add')")
+    @Log(title = "店铺推荐", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsStoreRecommendScrm fsStoreRecommendScrm)
+    {
+        return toAjax(fsStoreRecommendService.insertFsStoreRecommendScrm(fsStoreRecommendScrm));
+    }
+
+    /**
+     * 修改店铺推荐
+     */
+    @PreAuthorize("@ss.hasPermi('store:recommend:edit')")
+    @Log(title = "店铺推荐", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsStoreRecommendScrm fsStoreRecommendScrm)
+    {
+        return toAjax(fsStoreRecommendService.updateFsStoreRecommendScrm(fsStoreRecommendScrm));
+    }
+
+    /**
+     * 删除店铺推荐
+     */
+    @PreAuthorize("@ss.hasPermi('store:recommend:remove')")
+    @Log(title = "店铺推荐", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsStoreRecommendService.deleteFsStoreRecommendScrmByIds(ids));
+    }
+
+    /**
+     * 查询有效的推荐店铺列表(用于前端展示)
+     */
+    @GetMapping("/validList")
+    public TableDataInfo validList(FsStoreRecommendScrm fsStoreRecommendScrm)
+    {
+        startPage();
+        List<FsStoreRecommendScrm> list = fsStoreRecommendService.selectValidRecommendList(fsStoreRecommendScrm);
+        return getDataTable(list);
+    }
+}

+ 4 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreScrmMapper.java

@@ -1,6 +1,7 @@
 package com.fs.hisStore.mapper;
 
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -76,4 +77,6 @@ public interface FsStoreScrmMapper
 
     // 批量按ID更新状态
     int batchUpdateStatusByIds(@Param("ids") List<Long> ids, @Param("status") Integer status);
-}
+
+    List<FsStoreRecommendListVO> storeRecommendList();
+}

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

@@ -2,6 +2,7 @@ package com.fs.hisStore.service;
 
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.vo.FsStoreRecommendListVO;
 
 import java.util.List;
 
@@ -76,4 +77,6 @@ public interface IFsStoreScrmService
     List<FsStoreScrm> selectOverList();
 
     int batchUpdateStatusByIds(List<Long> ids, Integer status);
+
+    List<FsStoreRecommendListVO> storeRecommendList();
 }

+ 25 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -4,17 +4,21 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.his.utils.StoreMD5PasswordEncoder;
+import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.mapper.FsStoreProductScrmMapper;
 import com.fs.hisStore.mapper.FsStoreScrmMapper;
 import com.fs.hisStore.service.IFsHisStoreAuditLogScrmService;
 import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
+import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
@@ -32,6 +36,9 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
     @Autowired
     private StoreAuditLogUtil storeAuditLogUtil;
 
+    @Autowired
+    private FsStoreProductScrmMapper fsStoreProduct;
+
 
     /**
      * 查询店铺管理
@@ -173,4 +180,22 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
         return fsStoreMapper.batchUpdateStatusByIds(ids, status);
     }
 
+    @Override
+    public List<FsStoreRecommendListVO> storeRecommendList() {
+        FsStoreScrm fsStoreScrm = new FsStoreScrm();
+        fsStoreScrm.setStatus(1);//启用
+        fsStoreScrm.setIsAudit(1);//审核通过
+        List<FsStoreScrm>  storeList =  fsStoreMapper.selectFsStoreList( fsStoreScrm);
+        return storeList.stream().map(store -> {
+            FsStoreProductScrm fsStoreProductScrm = new FsStoreProductScrm();
+            fsStoreProductScrm.setStoreId(store.getStoreId());
+            fsStoreProductScrm.setIsAudit("1");//审核通过
+            fsStoreProductScrm.setIsGood(1);//推荐
+            fsStoreProductScrm.setIsShow(1);//上架
+            fsStoreProductScrm.setIsDel(0);
+            List<FsStoreProductScrm> fsStoreProductScrms = fsStoreProduct.selectFsStoreProductList(fsStoreProductScrm);
+            return FsStoreRecommendListVO.builder().store(store).recommendProductList(fsStoreProductScrms).build();
+        }).collect(Collectors.toList());
+    }
+
 }

+ 27 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreRecommendListVO.java

@@ -0,0 +1,27 @@
+package com.fs.hisStore.vo;
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import com.fs.hisStore.domain.FsStoreProductScrm;
+import com.fs.hisStore.domain.FsStoreScrm;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+ * 店铺管理推荐商品列表视图对象
+ *
+ */
+@Builder
+@Data
+public class FsStoreRecommendListVO
+{
+    private FsStoreScrm store;
+    /** 推荐商品列表*/
+    private List<FsStoreProductScrm> recommendProductList;
+
+}

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

@@ -140,24 +140,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeFactory != null  and prescribeFactory != ''"> and prescribe_factory = #{prescribeFactory}</if>
             <if test="prescribeName != null  and prescribeName != ''"> and prescribe_name like concat('%', #{prescribeName}, '%')</if>
             <if test="isDisplay != null "> and is_display = #{isDisplay}</if>
-            <if test="isDrug != null and isDrug != ''">and is_drug = #{isDrug} ,</if>
-            <if test="drugImage != null and drugImage != ''">and drug_image = #{drugImage} ,</if>
-            <if test="drugRegCertNo != null and drugRegCertNo != ''">and drug_reg_cert_no = #{drugRegCertNo} ,</if>
-            <if test="commonName != null and commonName != ''">and common_name = #{commonName} ,</if>
-            <if test="dosageForm != null and dosageForm != ''">and dosage_form = #{dosageForm} ,</if>
-            <if test="unitPrice != null and unitPrice != ''">and unit_price = #{unitPrice} ,</if>
-            <if test="batchNumber != null and batchNumber != ''">and batch_number = #{batchNumber} ,</if>
-            <if test="mah != null and mah != ''">and mah = #{mah} ,</if>
-            <if test="mahAddress != null and mahAddress != ''">and mah_address = #{mahAddress} ,</if>
-            <if test="manufacturer != null and manufacturer != ''">and manufacturer = #{manufacturer} ,</if>
-            <if test="manufacturerAddress != null and manufacturerAddress != ''">and manufacturer_address= #{manufacturerAddress} ,</if>
-            <if test="indications != null and indications != ''">and indications = #{indications} ,</if>
-            <if test="dosage != null and dosage != ''">and dosage = #{dosage} ,</if>
-            <if test="adverseReactions != null and adverseReactions != ''">and adverse_reactions = #{adverseReactions} ,</if>
-            <if test="contraindications != null and contraindications != ''">and contraindications = #{contraindications} ,</if>
-            <if test="precautions != null and precautions != ''">and precautions = #{precautions} ,</if>
-            <if test="isAudit != null and isAudit != ''">and is_audit = #{isAudit} ,</if>
-            <if test="storeId != null and storeId != ''">and store_id = #{storeId} ,</if>
+            <if test="isDrug != null and isDrug != ''">and is_drug = #{isDrug} </if>
+            <if test="drugImage != null and drugImage != ''">and drug_image = #{drugImage} </if>
+            <if test="drugRegCertNo != null and drugRegCertNo != ''">and drug_reg_cert_no = #{drugRegCertNo} </if>
+            <if test="commonName != null and commonName != ''">and common_name = #{commonName} </if>
+            <if test="dosageForm != null and dosageForm != ''">and dosage_form = #{dosageForm} </if>
+            <if test="unitPrice != null and unitPrice != ''">and unit_price = #{unitPrice} </if>
+            <if test="batchNumber != null and batchNumber != ''">and batch_number = #{batchNumber} </if>
+            <if test="mah != null and mah != ''">and mah = #{mah} </if>
+            <if test="mahAddress != null and mahAddress != ''">and mah_address = #{mahAddress} </if>
+            <if test="manufacturer != null and manufacturer != ''">and manufacturer = #{manufacturer} </if>
+            <if test="manufacturerAddress != null and manufacturerAddress != ''">and manufacturer_address= #{manufacturerAddress} </if>
+            <if test="indications != null and indications != ''">and indications = #{indications} </if>
+            <if test="dosage != null and dosage != ''">and dosage = #{dosage} </if>
+            <if test="adverseReactions != null and adverseReactions != ''">and adverse_reactions = #{adverseReactions} </if>
+            <if test="contraindications != null and contraindications != ''">and contraindications = #{contraindications} </if>
+            <if test="precautions != null and precautions != ''">and precautions = #{precautions} </if>
+            <if test="isAudit != null and isAudit != ''">and is_audit = #{isAudit} </if>
+            <if test="storeId != null and storeId != ''">and store_id = #{storeId} </if>
         </where>
     </select>
 

+ 13 - 2
fs-user-app/src/main/java/com/fs/app/controller/store/StoreScrmController.java

@@ -8,11 +8,13 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
+import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -58,7 +60,8 @@ public class StoreScrmController extends BaseController
     public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
     {
         FsStoreScrm fsStore = fsStoreService.selectFsStoreByStoreId(storeId);
-        fsStore.setPhone(ParseUtils.parsePhone(fsStore.getPhone()));
+        if(fsStore != null && fsStore.getPhone() != null)
+            fsStore.setPhone(ParseUtils.parsePhone(fsStore.getPhone()));
         return AjaxResult.success(fsStore);
     }
 
@@ -111,5 +114,13 @@ public class StoreScrmController extends BaseController
         return toAjax(fsStoreService.refreshFsStore(storeId));
     }
 
-
+    /**
+     * 返回多店铺下的推荐商品
+     * */
+    @GetMapping("/recommendList")
+    public TableDataInfo storeRecommend(FsStoreScrm fsStore){
+        startPage();
+        List<FsStoreRecommendListVO> fsStoreRecommendListVO = fsStoreService.storeRecommendList();
+        return getDataTable(fsStoreRecommendListVO);
+    }
 }