Selaa lähdekoodia

改造品牌内容,新增行情页面接口

jin 6 kuukautta sitten
vanhempi
commit
9295879943

+ 6 - 6
ruoyi-admin/src/main/resources/application.yml

@@ -121,11 +121,11 @@ springdoc:
     enabled: true
     path: /swagger-ui.html
     tags-sorter: alpha
-  group-configs:
-    - group: 'default'
-      display-name: '测试模块'
-      paths-to-match: '/**'
-      packages-to-scan: com.ruoyi.web.controller.tool
+#  group-configs:
+#    - group: 'default'
+#      display-name: '测试模块'
+#      paths-to-match: '/**'
+#      packages-to-scan: com.ruoyi.web.controller.tool
 
 # 防止XSS攻击
 xss:
@@ -139,4 +139,4 @@ xss:
 ftp_ip:  47.117.168.244
 ftp_user: 13167331622_cc
 ftp_pass: Ck14bzrjEPNHGMyy
-ftp_port: 21
+ftp_port: 21

+ 3 - 3
ruoyi-common/pom.xml

@@ -52,13 +52,13 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
-  
+
         <!-- JSON工具类 -->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
         </dependency>
-        
+
         <!-- 阿里JSON解析器 -->
         <dependency>
             <groupId>com.alibaba.fastjson2</groupId>
@@ -130,4 +130,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 5 - 4
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java

@@ -1,15 +1,16 @@
 package com.ruoyi.common.core.domain;
 
-import java.io.Serializable;
-import java.util.List;
-import java.util.stream.Collectors;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysMenu;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * Treeselect树结构实体类
- * 
+ *
  * @author ruoyi
  */
 public class TreeSelect implements Serializable

+ 7 - 2
ruoyi-framework/pom.xml

@@ -58,7 +58,12 @@
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-system</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>io.swagger.core.v3</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>2.1.2</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
-</project>
+</project>

+ 13 - 4
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/RecBrandController.java

@@ -23,7 +23,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 
 /**
  * 回收品牌Controller
- * 
+ *
  * @author jin
  * @date 2024-11-16
  */
@@ -39,11 +39,20 @@ public class RecBrandController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('recovery:brand:list')")
     @GetMapping("/list")
-    public TableDataInfo list(RecBrand recBrand)
+    public AjaxResult list(RecBrand recBrand)
     {
-        startPage();
         List<RecBrand> list = recBrandService.selectRecBrandList(recBrand);
-        return getDataTable(list);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 查询品牌下拉树列表
+     */
+    @GetMapping("/tree/select")
+    public AjaxResult treeselect(RecBrand recBrand)
+    {
+        List<RecBrand> list = recBrandService.selectRecBrandList(recBrand);
+        return AjaxResult.success(recBrandService.buildBrandSelect(list));
     }
 
     /**

+ 54 - 13
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecBrand.java

@@ -1,11 +1,13 @@
 package com.ruoyi.framework.recovery.domain;
 
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * 回收品牌对象 rec_brand
@@ -13,27 +15,45 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author jin
  * @date 2024-11-16
  */
+@Schema(description = "用户实体")
 public class RecBrand extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 回收品牌id */
+    @Schema(title = "回收品牌id")
     private Long id;
 
-    /** 品牌 */
-    @Excel(name = "品牌")
+    /** 品牌名称 */
+    @Excel(name = "品牌名称")
+    @Schema(title = "品牌名称")
     private String brand;
 
+    /**
+     * 父类id
+     */
+    @Schema(title = "父类id")
+    @Excel(name = "父类id")
+    private Long parentId;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
+    @Schema(title = "创建时间")
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createDate;
 
     /** 更新时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
+    @Schema(title = "更新时间")
     @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updateDate;
 
+    /**
+     * 子节点
+     */
+    @Schema(title = "子节点")
+    private List<RecBrand> children = new ArrayList<RecBrand>();
+
     public void setId(Long id)
     {
         this.id = id;
@@ -71,15 +91,36 @@ public class RecBrand extends BaseEntity
         return updateDate;
     }
 
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public Date getUpdateDate() {
+        return updateDate;
+    }
+
+    public List<RecBrand> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<RecBrand> children) {
+        this.children = children;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("brand", getBrand())
-            .append("createBy", getCreateBy())
-            .append("createDate", getCreateDate())
-            .append("updateBy", getUpdateBy())
-            .append("updateDate", getUdateDate())
-            .toString();
+        final StringBuffer sb = new StringBuffer("RecBrand{");
+        sb.append("id=").append(id);
+        sb.append(", brand='").append(brand).append('\'');
+        sb.append(", parentId=").append(parentId);
+        sb.append(", createDate=").append(createDate);
+        sb.append(", updateDate=").append(updateDate);
+        sb.append(", children=").append(children);
+        sb.append('}');
+        return sb.toString();
     }
 }

+ 2 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecStores.java

@@ -2,6 +2,7 @@ package com.ruoyi.framework.recovery.domain;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -13,6 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author jin
  * @date 2024-11-16
  */
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
 public class RecStores extends BaseEntity
 {
     private static final long serialVersionUID = -4720608856018159687L;

+ 77 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/vo/TreeSelectVo.java

@@ -0,0 +1,77 @@
+package com.ruoyi.framework.recovery.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysMenu;
+import com.ruoyi.framework.recovery.domain.RecBrand;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Treeselect树结构实体类
+ *
+ * @author ruoyi
+ */
+@Schema(description = "Treeselect树结构实体类")
+public class TreeSelectVo implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 节点ID */
+    @Schema(description = "节点ID")
+    private Long id;
+
+    /** 节点名称 */
+    @Schema(description = "节点名称")
+    private String label;
+
+    /** 子节点 */
+    @Schema(description = "子节点")
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<TreeSelectVo> children;
+
+    public TreeSelectVo()
+    {
+
+    }
+
+    public TreeSelectVo(RecBrand brand)
+    {
+        this.id = brand.getId();
+        this.label = brand.getBrand();
+        this.children = brand.getChildren().stream().map(TreeSelectVo::new).collect(Collectors.toList());
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+
+    public List<TreeSelectVo> getChildren()
+    {
+        return children;
+    }
+
+    public void setChildren(List<TreeSelectVo> children)
+    {
+        this.children = children;
+    }
+}

+ 19 - 8
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IRecBrandService.java

@@ -1,19 +1,22 @@
 package com.ruoyi.framework.recovery.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.TreeSelect;
 import com.ruoyi.framework.recovery.domain.RecBrand;
+import com.ruoyi.framework.recovery.domain.vo.TreeSelectVo;
 
 /**
  * 回收品牌Service接口
- * 
+ *
  * @author jin
  * @date 2024-11-16
  */
-public interface IRecBrandService 
+public interface IRecBrandService
 {
     /**
      * 查询回收品牌
-     * 
+     *
      * @param id 回收品牌主键
      * @return 回收品牌
      */
@@ -21,7 +24,7 @@ public interface IRecBrandService
 
     /**
      * 查询回收品牌列表
-     * 
+     *
      * @param recBrand 回收品牌
      * @return 回收品牌集合
      */
@@ -29,7 +32,7 @@ public interface IRecBrandService
 
     /**
      * 新增回收品牌
-     * 
+     *
      * @param recBrand 回收品牌
      * @return 结果
      */
@@ -37,7 +40,7 @@ public interface IRecBrandService
 
     /**
      * 修改回收品牌
-     * 
+     *
      * @param recBrand 回收品牌
      * @return 结果
      */
@@ -45,7 +48,7 @@ public interface IRecBrandService
 
     /**
      * 批量删除回收品牌
-     * 
+     *
      * @param ids 需要删除的回收品牌主键集合
      * @return 结果
      */
@@ -53,9 +56,17 @@ public interface IRecBrandService
 
     /**
      * 删除回收品牌信息
-     * 
+     *
      * @param id 回收品牌主键
      * @return 结果
      */
     public int deleteRecBrandById(Long id);
+
+    /**
+     * 构建前端所需树结构
+     *
+     * @param list 品牌列表
+     * @return 下拉树结构
+     */
+    List<TreeSelectVo> buildBrandSelect(List<RecBrand> list);
 }

+ 91 - 5
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/RecBrandServiceImpl.java

@@ -1,12 +1,18 @@
 package com.ruoyi.framework.recovery.service.impl;
 
-import java.util.Date;
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.framework.recovery.mapper.RecBrandMapper;
+import com.ruoyi.common.core.domain.TreeSelect;
 import com.ruoyi.framework.recovery.domain.RecBrand;
+import com.ruoyi.framework.recovery.domain.vo.TreeSelectVo;
+import com.ruoyi.framework.recovery.mapper.RecBrandMapper;
 import com.ruoyi.framework.recovery.service.IRecBrandService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 回收品牌Service业务层处理
@@ -92,4 +98,84 @@ public class RecBrandServiceImpl implements IRecBrandService
     {
         return recBrandMapper.deleteRecBrandById(id);
     }
+
+    @Override
+    public List<TreeSelectVo> buildBrandSelect(List<RecBrand> list) {
+        List<RecBrand> brands = buildMenuTree(list);
+        return brands.stream().map(TreeSelectVo::new).collect(Collectors.toList());
+    }
+
+    /**
+     * 构建前端所需要树结构
+     *
+     * @param menus 菜单列表
+     * @return 树结构列表
+     */
+    public List<RecBrand> buildMenuTree(List<RecBrand> menus)
+    {
+        List<RecBrand> returnList = new ArrayList<>();
+        List<Long> tempList = menus.stream().map(RecBrand::getId).collect(Collectors.toList());
+        for (Iterator<RecBrand> iterator = menus.iterator(); iterator.hasNext();)
+        {
+            RecBrand menu = iterator.next();
+            // 如果是顶级节点, 遍历该父节点的所有子节点
+            if (!tempList.contains(menu.getParentId()))
+            {
+                recursionFn(menus, menu);
+                returnList.add(menu);
+            }
+        }
+        if (returnList.isEmpty())
+        {
+            returnList = menus;
+        }
+        return returnList;
+    }
+
+    /**
+     * 递归列表
+     *
+     * @param list 分类表
+     * @param t 子节点
+     */
+    private void recursionFn(List<RecBrand> list, RecBrand t)
+    {
+        // 得到子节点列表
+        List<RecBrand> childList = getChildList(list, t);
+        t.setChildren(childList);
+        for (RecBrand tChild : childList)
+        {
+            if (hasChild(list, tChild))
+            {
+                recursionFn(list, tChild);
+            }
+        }
+    }
+
+    /**
+     * 得到子节点列表
+     */
+    private List<RecBrand> getChildList(List<RecBrand> list, RecBrand t)
+    {
+        List<RecBrand> tlist = new ArrayList<>();
+        Iterator<RecBrand> it = list.iterator();
+        while (it.hasNext())
+        {
+            RecBrand n = (RecBrand) it.next();
+            if (n.getParentId().longValue() == t.getId().longValue())
+            {
+                tlist.add(n);
+            }
+        }
+        return tlist;
+    }
+
+    /**
+     * 判断是否有子节点
+     */
+    private boolean hasChild(List<RecBrand> list, RecBrand t)
+    {
+        return getChildList(list, t).size() > 0;
+    }
+
 }

+ 7 - 1
ruoyi-system/src/main/resources/mapper/system/RecBrandMapper.xml

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="RecBrand" id="RecBrandResult">
         <result property="id"    column="id"    />
         <result property="brand"    column="brand"    />
+        <result property="parentId"    column="parent_id"    />
         <result property="createBy"    column="create_by"    />
         <result property="createDate"    column="create_date"    />
         <result property="updateBy"    column="update_by"    />
@@ -14,16 +15,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectRecBrandVo">
-        select id, brand, create_by, create_date, update_by, update_date from rec_brand
+        select id, brand, parent_id, create_by, create_date, update_by, update_date from rec_brand
     </sql>
 
     <select id="selectRecBrandList" parameterType="RecBrand" resultMap="RecBrandResult">
         <include refid="selectRecBrandVo"/>
         <where>
             <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
+            <if test="parentId != null"> and parent_id = #{parentId}</if>
             <if test="createDate != null "> and create_date = #{createDate}</if>
             <if test="updateDate != null "> and update_date = #{updateDate}</if>
         </where>
+        order by parent_id, id
     </select>
 
     <select id="selectRecBrandById" parameterType="Long" resultMap="RecBrandResult">
@@ -35,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         insert into rec_brand
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="brand != null">brand,</if>
+            <if test="parentId != null">parent_id,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createDate != null">create_date,</if>
             <if test="updateBy != null">update_by,</if>
@@ -42,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="brand != null">#{brand},</if>
+            <if test="parentId != null">#{parentId},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createDate != null">#{createDate},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -53,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update rec_brand
         <trim prefix="SET" suffixOverrides=",">
             <if test="brand != null">brand = #{brand},</if>
+            <if test="parentId != null">parent_id = #{parentId},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createDate != null">create_date = #{createDate},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 1 - 1
ruoyi-ui/vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://49.235.117.140:8080`,
+        target: `http://localhost:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''

+ 63 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxQuotationController.java

@@ -0,0 +1,63 @@
+package com.ruoyi.wx.web.controller;
+
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.recovery.domain.RecBrand;
+import com.ruoyi.wx.web.domain.vo.GoodsInfoVo;
+import com.ruoyi.wx.web.service.IWxQuotationService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 行情服务
+ */
+@Tag(name = "行情服务")
+@RestController
+@RequestMapping("/wx/quotation")
+@Slf4j
+public class WxQuotationController {
+
+    @Autowired
+    private IWxQuotationService quotationService;
+
+    @Operation(summary = "行情页品牌内容")
+    @GetMapping("/index")
+    public AjaxResult getIndex() {
+        try {
+            List<RecBrand> brands = quotationService.getBrands();
+            return AjaxResult.success(brands);
+        } catch (Exception e) {
+            return AjaxResult.error();
+        }
+    }
+
+    @Operation(summary = "行情页左侧品牌型号")
+    @GetMapping("/model/{id}")
+    public AjaxResult getModel(@PathVariable("id") Long id) {
+        try {
+            List<RecBrand> brandSeries = quotationService.getBrandSeries(id);
+            return AjaxResult.success(brandSeries);
+        } catch (Exception e) {
+            return AjaxResult.error();
+        }
+    }
+
+    @Operation(summary = "右侧所有信息")
+    @GetMapping("/info/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        try {
+            List<GoodsInfoVo> goodsInfoVos = quotationService.getGoodsInfo(id);
+            return AjaxResult.success(goodsInfoVos);
+        } catch (Exception e) {
+            return AjaxResult.error();
+        }
+    }
+}

+ 106 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/GoodsInfoVo.java

@@ -0,0 +1,106 @@
+package com.ruoyi.wx.web.domain.vo;
+
+import com.ruoyi.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+import java.math.BigDecimal;
+@Schema(description = "用户实体")
+@ApiModel(value = "物品详情实体类")
+public class GoodsInfoVo {
+    /**
+     * id
+     */
+    @Schema(title = "id")
+    private Long id;
+
+    /** 型号 */
+    @Excel(name = "型号")
+    @Schema(title = "型号")
+    private String model;
+
+    /** 发售价 */
+    @Excel(name = "发售价")
+    @Schema(title = "发售价")
+    private BigDecimal sale;
+
+    /** 市场价 */
+    @Excel(name = "市场价")
+    @Schema(title = "市场价")
+    private BigDecimal market;
+
+    /**
+     * 商品规格
+     */
+    @Excel(name = "商品规格")
+    @Schema(title = "商品规格")
+    private String specs;
+
+    /**
+     * 市场价和售价价差
+     */
+    @Excel(name = "价格差")
+    @Schema(title = "价格差")
+    private BigDecimal arbitrage;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public BigDecimal getSale() {
+        return sale;
+    }
+
+    public void setSale(BigDecimal sale) {
+        this.sale = sale;
+    }
+
+    public BigDecimal getMarket() {
+        return market;
+    }
+
+    public void setMarket(BigDecimal market) {
+        this.market = market;
+    }
+
+    public String getSpecs() {
+        return specs;
+    }
+
+    public void setSpecs(String specs) {
+        this.specs = specs;
+    }
+
+    public BigDecimal getArbitrage() {
+        return arbitrage;
+    }
+
+    public void setArbitrage(BigDecimal arbitrage) {
+        this.arbitrage = arbitrage;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("GoodsInfoVo{");
+        sb.append("id=").append(id);
+        sb.append(", model='").append(model).append('\'');
+        sb.append(", sale=").append(sale);
+        sb.append(", market=").append(market);
+        sb.append(", specs='").append(specs).append('\'');
+        sb.append(", arbitrage=").append(arbitrage);
+        sb.append('}');
+        return sb.toString();
+    }
+}

+ 10 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/mapper/WxQuotationMapper.java

@@ -0,0 +1,10 @@
+package com.ruoyi.wx.web.mapper;
+
+import com.ruoyi.framework.recovery.domain.RecBrand;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface WxQuotationMapper {
+}

+ 32 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxQuotationService.java

@@ -0,0 +1,32 @@
+package com.ruoyi.wx.web.service;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.recovery.domain.RecBrand;
+import com.ruoyi.wx.web.domain.vo.GoodsInfoVo;
+
+import java.util.List;
+
+public interface IWxQuotationService {
+    /**
+     * 获取所有行情品牌
+     *
+     * @return 品牌结果集
+     */
+    List<RecBrand> getBrands();
+
+    /**
+     * 根据品牌id查询所有相关内容
+     *
+     * @param id
+     * @return
+     */
+    List<RecBrand> getBrandSeries(Long id);
+
+    /**
+     * 根据系列id,查询所有系列的物品详细信息
+     *
+     * @param id 系列id
+     * @return 详情信息
+     */
+    List<GoodsInfoVo> getGoodsInfo(Long id);
+}

+ 57 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxQuotationServiceImpl.java

@@ -0,0 +1,57 @@
+package com.ruoyi.wx.web.service.impl;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.framework.recovery.domain.RecBrand;
+import com.ruoyi.framework.recovery.domain.RecCommodity;
+import com.ruoyi.framework.recovery.mapper.RecBrandMapper;
+import com.ruoyi.framework.recovery.mapper.RecCommodityMapper;
+import com.ruoyi.wx.web.domain.vo.GoodsInfoVo;
+import com.ruoyi.wx.web.mapper.WxQuotationMapper;
+import com.ruoyi.wx.web.service.IWxQuotationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@Service
+public class WxQuotationServiceImpl implements IWxQuotationService {
+    @Autowired
+    private RecBrandMapper recBrandMapper;
+
+    @Autowired
+    private RecCommodityMapper commodityMapper;
+
+    @Override
+    public List<RecBrand> getBrands() {
+        RecBrand recBrand = new RecBrand();
+        recBrand.setParentId(0L);
+        List<RecBrand> brands = recBrandMapper.selectRecBrandList(recBrand);
+        return brands;
+    }
+
+    @Override
+    public List<RecBrand> getBrandSeries(Long id) {
+        RecBrand recBrand = new RecBrand();
+        recBrand.setParentId(id);
+        List<RecBrand> seriesList =  recBrandMapper.selectRecBrandList(recBrand);
+        return seriesList;
+    }
+
+    @Override
+    public List<GoodsInfoVo> getGoodsInfo(Long id) {
+        RecCommodity commodity = new RecCommodity();
+        commodity.setBrandId(id);
+        List<RecCommodity> commodityList = commodityMapper.selectRecCommodityList(commodity);
+        List<GoodsInfoVo> goodsInfoVos = new ArrayList<>();
+        commodityList.forEach(com -> {
+            GoodsInfoVo goodsInfoVo = new GoodsInfoVo();
+            BeanUtils.copyBeanProp(goodsInfoVo, com);
+            goodsInfoVo.setArbitrage(goodsInfoVo.getMarket().subtract(goodsInfoVo.getSale()));
+            goodsInfoVos.add(goodsInfoVo);
+        });
+        return goodsInfoVos;
+    }
+}

+ 7 - 0
ruoyi-wx/src/main/resources/mapper/web/WxQuotationMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.wx.web.mapper.WxQuotationMapper">
+
+</mapper>