Просмотр исходного кода

代码提交,商品展示、代码迁移、字典图片上传逻辑新增

yjwang 4 дней назад
Родитель
Сommit
d656af0beb

+ 14 - 0
fs-admin/src/main/java/com/fs/web/controller/common/CommonController.java

@@ -177,6 +177,20 @@ public class CommonController
         String url = storage.uploadSuffix(file.getBytes(), suffix);
         return R.ok().put("url",url);
     }
+
+    @PostMapping("/common/uploadImage")
+    public R uploadImage(@RequestParam("file") MultipartFile file) throws Exception
+    {
+        if (file.isEmpty())
+        {
+            throw new OssException("上传文件不能为空");
+        }
+        String fileName = file.getOriginalFilename();
+        String suffix = fileName.substring(fileName.lastIndexOf("."));
+        CloudStorageService storage = OSSFactory.build();
+        String url = storage.uploadSuffix(file.getBytes(), suffix);
+        return R.ok().put("url",url);
+    }
     @PostMapping("/common/uploadWang")
     public WangUploadVO uploadWang(@RequestParam(value = "fileName", required = false) MultipartFile file) throws Exception
     {

+ 14 - 0
fs-common/src/main/java/com/fs/common/core/domain/entity/SysDictData.java

@@ -41,6 +41,9 @@ public class SysDictData extends BaseEntity
     /** 样式属性(其他样式扩展) */
     private String cssClass;
 
+    /** 字典图片地址 */
+    private String dictImage;
+
     /** 表格字典样式 */
     private String listClass;
 
@@ -119,6 +122,16 @@ public class SysDictData extends BaseEntity
         this.cssClass = cssClass;
     }
 
+    public String getDictImage()
+    {
+        return dictImage;
+    }
+
+    public void setDictImage(String dictImage)
+    {
+        this.dictImage = dictImage;
+    }
+
     public String getListClass()
     {
         return listClass;
@@ -163,6 +176,7 @@ public class SysDictData extends BaseEntity
             .append("dictValue", getDictValue())
             .append("dictType", getDictType())
             .append("cssClass", getCssClass())
+            .append("dictImage", getDictImage())
             .append("listClass", getListClass())
             .append("isDefault", getIsDefault())
             .append("status", getStatus())

+ 1 - 0
fs-framework/src/main/java/com/fs/framework/config/SecurityConfig.java

@@ -133,6 +133,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("//his/pay/*").anonymous()
                 .antMatchers("/common/getId**").anonymous()
                 .antMatchers("/common/uploadOSS**").anonymous()
+                .antMatchers("/common/uploadImage**").permitAll()
                 .antMatchers("/chat/upload/uploadFile**").anonymous()
                 .antMatchers("/common/uploadWang**").anonymous()
                 .antMatchers("/common/download**").anonymous()

+ 6 - 0
fs-service/src/main/java/com/fs/his/config/PointsGrantRuleConfig.java

@@ -16,6 +16,9 @@ public class PointsGrantRuleConfig implements Serializable {
     /** 积分发放比例:1元 = X积分(保留两位小数) */
     private BigDecimal rate;
 
+    /** 积分支付比例:X积分 = 1元(整数,如100表示100积分抵1元) */
+    private Integer payRate;
+
     /** 参与范围:1=全场商品参与, 2=指定商品分类不参与, 3=指定单个商品不参与 */
     private Integer scopeType;
 
@@ -37,6 +40,9 @@ public class PointsGrantRuleConfig implements Serializable {
     /** 订单最高抵扣积分(0=不限制):用户每笔订单最多可用积分抵扣的数量 */
     private Integer maxDeduct;
 
+    /** 满X元可抵扣(0=不限制):订单金额达到此阈值才可使用积分抵扣 */
+    private BigDecimal minDeductAmount;
+
     /** 是否启用:0=禁用 1=启用 */
     private Integer enabled;
 }

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

@@ -14,6 +14,7 @@ import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.param.FsStoreCartCountParam;
 import com.fs.statis.dto.ModifyMoreDTO;
 import com.fs.hisStore.domain.FsStoreProductScrm;
+import com.fs.hisStore.param.FsStoreProductTuiCateQueryParam;
 import com.fs.hisStore.param.FsStoreProductQueryParam;
 import com.fs.hisStore.vo.*;
 import com.fs.statis.dto.ProductAuditDTO;
@@ -486,6 +487,12 @@ public interface FsStoreProductScrmMapper
     List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(@Param("config") MedicalMallConfig  config, @Param("isDrug") Integer isDrug);
 
     List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(@Param("config") MedicalMallConfig  config);
+
+    /**
+     * 按推荐分类分页查询已上架商品(联表 fs_store_scrm 过滤店铺状态)
+     */
+    List<FsStoreProductListQueryVO> selectFsStoreProductByTuiCateId(@Param("param") FsStoreProductTuiCateQueryParam param);
+
     @Select({"<script> " +
             "select count(1) from fs_store_product_scrm  " +
             "where 1=1 " +

+ 24 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreProductTuiCateQueryParam.java

@@ -0,0 +1,24 @@
+package com.fs.hisStore.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * 按推荐分类分页查询商品入参
+ * 继承自 FsStoreProductQueryParam 的所有筛选条件(分类/商品名/店铺/排序等),
+ * 联表 fs_store_scrm,仅返回店铺状态正常的已上架商品
+ *
+ * @author system
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsStoreProductTuiCateQueryParam extends FsStoreProductQueryParam implements Serializable {
+
+    /** 推荐分类ID */
+    @ApiModelProperty(value = "推荐分类ID", required = true)
+    private Long tuiCateId;
+
+}

+ 6 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreProductScrmService.java

@@ -20,6 +20,7 @@ import com.fs.statis.dto.ModifyMoreDTO;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.param.FsStoreProductAddEditParam;
 import com.fs.hisStore.param.FsStoreProductQueryParam;
+import com.fs.hisStore.param.FsStoreProductTuiCateQueryParam;
 import com.fs.statis.dto.ProductAuditDTO;
 
 /**
@@ -132,6 +133,11 @@ public interface IFsStoreProductScrmService
 
     List<FsStoreProductActivityListVO> selectFsStoreProductByIds(String productIds);
 
+    /**
+     * 按推荐分类分页查询已上架商品(联表 fs_store_scrm,仅返回店铺状态正常的商品)
+     */
+    List<FsStoreProductListQueryVO> selectFsStoreProductByTuiCateId(FsStoreProductTuiCateQueryParam param);
+
     int updateStock(Long productId);
 
     List<FsStoreProductExportVO> selectFsStoreProductExportList(FsStoreProductScrm fsStoreProduct);

+ 4 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsPlatformProductScrmServiceImpl.java

@@ -266,7 +266,7 @@ public class FsPlatformProductScrmServiceImpl implements IFsPlatformProductScrmS
             return R.error("复制,商品数据不存在!");
         }
         //存在,这个商品是否已经在我店铺存在了
-        boolean existFlag = fsStoreProductMapper.productNameExist(copyProductInfo.getProductName(), copyProductInfo.getCommonName(),fsStoreProduct.getStoreId());
+        boolean existFlag = fsStoreProductMapper.productNameExist(fsStoreProduct.getProductName(), copyProductInfo.getCommonName(),fsStoreProduct.getStoreId());
         if(existFlag){
             return R.error("这个商品你店铺已经有了,无需重复添加!");
         }
@@ -275,6 +275,9 @@ public class FsPlatformProductScrmServiceImpl implements IFsPlatformProductScrmS
         FsStoreProductScrm fsStoreProductScrm = new FsStoreProductScrm();
         BeanUtils.copyProperties(copyProductInfo, fsStoreProductScrm); //copy
         fsStoreProductScrm.setProductId(null);
+        if(StringUtils.isNotBlank(fsStoreProduct.getProductName()) && !fsStoreProduct.getProductName().equals("-")){
+            fsStoreProductScrm.setProductName(fsStoreProduct.getProductName());
+        }
         fsStoreProductScrm.setIsShow(0);//下架状态
         fsStoreProductScrm.setIsAudit("0");//未审核状态
         fsStoreProductScrm.setCreateTime(new Date());

+ 6 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -55,6 +55,7 @@ import com.fs.hisStore.dto.ProductArrtDTO;
 import com.fs.hisStore.dto.ProductAttrCountDto;
 import com.fs.hisStore.param.FsStoreProductAddEditParam;
 import com.fs.hisStore.param.FsStoreProductQueryParam;
+import com.fs.hisStore.param.FsStoreProductTuiCateQueryParam;
 import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
 import com.fs.hisStore.vo.*;
 import com.fs.statis.dto.ProductAuditDTO;
@@ -1023,6 +1024,11 @@ private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsS
         return fsStoreProductMapper.selectFsStoreProductGoodListQuery(medicalMallConfig);
     }
 
+    @Override
+    public List<FsStoreProductListQueryVO> selectFsStoreProductByTuiCateId(FsStoreProductTuiCateQueryParam param) {
+        return fsStoreProductMapper.selectFsStoreProductByTuiCateId(param);
+    }
+
     @Override
     public Long selectFsStoreProductCount(int type) {
         return fsStoreProductMapper.selectFsStoreProductCount(type);

+ 1 - 1
fs-service/src/main/java/com/fs/system/mapper/SysDictDataMapper.java

@@ -95,7 +95,7 @@ public interface SysDictDataMapper
      * @return 结果
      */
     public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
-    @Select("select dict_type,dict_label,dict_value from sys_dict_data where dict_type =#{dictType} and status = 0")
+    @Select("select dict_type,dict_label,dict_value,dict_image from sys_dict_data where dict_type =#{dictType} and status = 0")
     List<DictVO> selectDictDataListByType(String dictType);
 
     SysDictData selectDictDataByTypeAndValue(@Param("type") String type, @Param("value") String value);

+ 9 - 0
fs-service/src/main/java/com/fs/system/vo/DictVO.java

@@ -6,6 +6,7 @@ public class DictVO implements Serializable {
     String dictType;
     String dictLabel;
     String dictValue;
+    String dictImage;
 
     public String getDictType() {
         return dictType;
@@ -30,4 +31,12 @@ public class DictVO implements Serializable {
     public void setDictValue(String dictValue) {
         this.dictValue = dictValue;
     }
+
+    public String getDictImage() {
+        return dictImage;
+    }
+
+    public void setDictImage(String dictImage) {
+        this.dictImage = dictImage;
+    }
 }

+ 2 - 0
fs-service/src/main/resources/application-config-druid-yjb.yml

@@ -12,6 +12,8 @@ logging:
       fs:
         course:
           mapper:  debug
+        hisStore:
+          mapper: debug
 wx:
   open:
       appId: wx7796a33a71912e32 #互易享(三方入驻APP)

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

@@ -634,6 +634,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             GROUP BY fsp.product_name
             ORDER BY fsp.sort DESC, fsp.product_id DESC
     </select>
+
+    <select id="selectFsStoreProductByTuiCateId" resultType="com.fs.hisStore.vo.FsStoreProductListQueryVO">
+        SELECT
+            fsp.*,
+            fs.store_name AS storeName,
+            t_all.storeCountAll AS storeCount
+        FROM fs_store_product_scrm fsp
+        INNER JOIN fs_store_scrm fs ON fs.store_id = fsp.store_id AND fs.status = '1'
+        LEFT JOIN (
+            SELECT
+                product_name,
+                COUNT(DISTINCT store_id) AS storeCountAll
+            FROM fs_store_product_scrm
+            WHERE is_del = 0 AND is_show = 1
+            GROUP BY product_name
+        ) t_all ON t_all.product_name = fsp.product_name
+        WHERE fsp.is_del = 0
+          AND fsp.is_show = 1
+          AND fsp.tui_cate_id = #{param.tuiCateId}
+        <if test="param.isDisplay != null">
+            AND fsp.is_display = #{param.isDisplay}
+        </if>
+        <if test="param.productName != null and param.productName != ''">
+            AND (fsp.product_name LIKE CONCAT('%', #{param.productName}, '%')
+                 OR fsp.keyword LIKE CONCAT('%', #{param.productName}, '%'))
+        </if>
+        <if test="param.cateId != null">
+            AND fsp.cate_id = #{param.cateId}
+        </if>
+        <if test="param.storeId != null">
+            AND fsp.store_id = #{param.storeId}
+        </if>
+        <if test="param.isGood != null">
+            AND fsp.is_good = #{param.isGood}
+        </if>
+        <if test="param.isDrug != null">
+            AND fsp.is_drug = #{param.isDrug}
+        </if>
+        <if test="param.productType != null">
+            AND fsp.product_type = #{param.productType}
+        </if>
+        <choose>
+            <when test="param.defaultOrder == 'desc'">
+                ORDER BY fsp.sort DESC, fsp.product_id DESC
+            </when>
+            <when test="param.priceOrder == 'desc'">
+                ORDER BY fsp.price DESC, fsp.product_id DESC
+            </when>
+            <when test="param.priceOrder == 'asc'">
+                ORDER BY fsp.price ASC, fsp.product_id DESC
+            </when>
+            <when test="param.salesOrder == 'desc'">
+                ORDER BY fsp.sales DESC, fsp.product_id DESC
+            </when>
+            <when test="param.salesOrder == 'asc'">
+                ORDER BY fsp.sales ASC, fsp.product_id DESC
+            </when>
+            <when test="param.newOrder == 'desc'">
+                ORDER BY fsp.is_new DESC, fsp.create_time DESC, fsp.product_id DESC
+            </when>
+            <otherwise>
+                ORDER BY fsp.sort DESC, fsp.create_time DESC
+            </otherwise>
+        </choose>
+    </select>
+
     <select id="bulkCopyFsStoreProductByIds" resultMap="FsStoreProductResult">
         <include refid="selectFsStoreProductVo"/>
         where product_id in

+ 8 - 4
fs-service/src/main/resources/mapper/system/SysDictDataMapper.xml

@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="dictValue"  column="dict_value"  />
 		<result property="dictType"   column="dict_type"   />
 		<result property="cssClass"   column="css_class"   />
+		<result property="dictImage"  column="dict_image"  />
 		<result property="listClass"  column="list_class"  />
 		<result property="isDefault"  column="is_default"  />
 		<result property="status"     column="status"      />
@@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectDictDataVo">
-        select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark 
+        select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, dict_image, list_class, is_default, status, create_by, create_time, remark 
 		from sys_dict_data
     </sql>
 
@@ -82,7 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  			<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  			<if test="cssClass != null">css_class = #{cssClass},</if>
- 			<if test="listClass != null">list_class = #{listClass},</if>
+			<if test="dictImage != null">dict_image = #{dictImage},</if>
+			<if test="listClass != null">list_class = #{listClass},</if>
  			<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  			<if test="status != null">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
@@ -103,7 +105,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="dictValue != null and dictValue != ''">dict_value,</if>
  			<if test="dictType != null and dictType != ''">dict_type,</if>
  			<if test="cssClass != null and cssClass != ''">css_class,</if>
- 			<if test="listClass != null and listClass != ''">list_class,</if>
+			<if test="dictImage != null and dictImage != ''">dict_image,</if>
+			<if test="listClass != null and listClass != ''">list_class,</if>
  			<if test="isDefault != null and isDefault != ''">is_default,</if>
  			<if test="status != null">status,</if>
  			<if test="remark != null and remark != ''">remark,</if>
@@ -115,7 +118,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  			<if test="dictType != null and dictType != ''">#{dictType},</if>
  			<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
- 			<if test="listClass != null and listClass != ''">#{listClass},</if>
+			<if test="dictImage != null and dictImage != ''">#{dictImage},</if>
+			<if test="listClass != null and listClass != ''">#{listClass},</if>
  			<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  			<if test="status != null">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>

+ 10 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/ProductScrmController.java

@@ -320,6 +320,16 @@ public class ProductScrmController extends AppBaseController {
 
         return R.ok().put("data",listPageInfo);
     }
+
+    @ApiOperation("按推荐分类分页查询商品")
+    @GetMapping("/getProductsByTuiCateId")
+    public R getProductsByTuiCateId(@Validated FsStoreProductTuiCateQueryParam param, HttpServletRequest request) {
+        PageHelper.startPage(param.getPage(), param.getPageSize());
+        List<FsStoreProductListQueryVO> list = productService.selectFsStoreProductByTuiCateId(param);
+        PageInfo<FsStoreProductListQueryVO> listPageInfo = new PageInfo<>(list);
+        return R.ok().put("data", listPageInfo);
+    }
+
     @ApiOperation("获取喜欢商品数据")
     @GetMapping("/getGoodsProducts")
     public R getGoodsProducts(BaseQueryParam param, HttpServletRequest request){