Browse Source

行情\行情产品配置

刘浩男 1 year ago
parent
commit
6a9619dec1

+ 113 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/quotations/JnbQuotationsConfigController.java

@@ -0,0 +1,113 @@
+package com.ruoyi.web.controller.quotations;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.sooka.jnb.quotations.domain.JnbQuotationsConfig;
+import com.sooka.jnb.quotations.service.IJnbQuotationsConfigService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 行情产品配置Controller
+ *
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@RestController
+@RequestMapping("/quotationsConfig")
+public class JnbQuotationsConfigController extends BaseController {
+    @Autowired
+    private IJnbQuotationsConfigService jnbQuotationsConfigService;
+
+    /**
+     * 查询行情产品配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(JnbQuotationsConfig jnbQuotationsConfig) {
+        startPage();
+        List<JnbQuotationsConfig> list = jnbQuotationsConfigService.selectJnbQuotationsConfigList(jnbQuotationsConfig);
+        System.out.println(list);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取行情产品配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(jnbQuotationsConfigService.selectJnbQuotationsConfigById(id));
+    }
+
+    /**
+     * 新增行情产品配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:add')")
+    @Log(title = "行情产品配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody JnbQuotationsConfig jnbQuotationsConfig) {
+        int i = jnbQuotationsConfigService.insertJnbQuotationsConfig(jnbQuotationsConfig);
+        if (i > 0){
+            return toAjax(i);
+        }else {
+            return AjaxResult.error("同级已存在相同名称产品");
+        }
+    }
+
+    /**
+     * 修改行情产品配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:edit')")
+    @Log(title = "行情产品配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody JnbQuotationsConfig jnbQuotationsConfig) {
+        int i =jnbQuotationsConfigService.updateJnbQuotationsConfig(jnbQuotationsConfig);
+        if (i > 0){
+            return toAjax(i);
+        }else {
+            return AjaxResult.error("同级已存在相同名称产品");
+        }
+    }
+
+    /**
+     * 删除行情产品配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:remove')")
+    @Log(title = "行情产品配置", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{id}")
+    public AjaxResult remove(@PathVariable Long id) {
+        int i = jnbQuotationsConfigService.deleteJnbQuotationsConfigByIds(id);
+        if (i > 0){
+            return toAjax(i);
+        }else {
+            return AjaxResult.error("存在子级产品");
+        }
+    }
+
+    /**
+     * 查询树结构
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:config:list')")
+    @Log(title = "行情产品配置")
+    @GetMapping("all")
+    public AjaxResult all(JnbQuotationsConfig jnbQuotationsConfig) {
+        return AjaxResult.success(jnbQuotationsConfigService.quotationsTree(jnbQuotationsConfig));
+    }
+}

+ 91 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/quotations/JnbQuotationsController.java

@@ -0,0 +1,91 @@
+package com.ruoyi.web.controller.quotations;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.sooka.jnb.quotations.domain.JnbQuotations;
+import com.sooka.jnb.quotations.service.IJnbQuotationsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 行情Controller
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@RestController
+@RequestMapping("/quotations")
+public class JnbQuotationsController extends BaseController
+{
+    @Autowired
+    private IJnbQuotationsService jnbQuotationsService;
+
+    /**
+     * 查询行情列表
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:quotations:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(JnbQuotations jnbQuotations)
+    {
+        startPage();
+        List<JnbQuotations> list = jnbQuotationsService.selectJnbQuotationsList(jnbQuotations);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取行情详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:quotations:query')")
+    @GetMapping(value = "/{id}/{type}")
+    public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("type")Integer type)
+    {
+        return success(jnbQuotationsService.selectJnbQuotationsById(id,type));
+    }
+
+    /**
+     * 新增行情
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:quotations:add')")
+    @Log(title = "行情", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody JnbQuotations jnbQuotations)
+    {
+        int i = jnbQuotationsService.insertJnbQuotations(jnbQuotations);
+        if (i > 0) {
+            return toAjax(i);
+        } else {
+            return AjaxResult.error("产品名称已存在");
+        }
+    }
+
+    /**
+     * 修改行情
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:quotations:edit')")
+    @Log(title = "行情", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody JnbQuotations jnbQuotations)
+    {
+            return AjaxResult.success( jnbQuotationsService.updateJnbQuotations(jnbQuotations));
+
+    }
+
+    /**
+     * 删除行情
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:quotations:remove')")
+    @Log(title = "行情", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}/{type}")
+    public AjaxResult remove(@PathVariable Long[] ids,@PathVariable("type")Integer type)
+    {
+        return toAjax(jnbQuotationsService.deleteJnbQuotationsByIds(ids,type));
+    }
+}

+ 69 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/domain/JnbQuotations.java

@@ -0,0 +1,69 @@
+package com.sooka.jnb.quotations.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.math.BigDecimal;
+
+/**
+ * 行情对象 jnb_quotations
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@Data
+public class JnbQuotations extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键id */
+    private Long id;
+
+    /** 产品名称 */
+    @Excel(name = "产品名称")
+    @NotBlank(message = "产品名称不能为空")
+    private String productName;
+
+    /** 地区 */
+    @Excel(name = "地区")
+    @NotBlank(message = "地区不能为空")
+    private String area;
+
+    /** 类型 */
+    @Excel(name = "类型")
+    @NotBlank(message = "类型不能为空")
+    private String type;
+
+    /** 价格 */
+    @Excel(name = "价格")
+    @NotBlank(message = "价格不能为空")
+    private BigDecimal price;
+
+    /** 手机号 */
+    @Excel(name = "手机号")
+    @NotBlank(message = "手机号不能为空")
+    private String phone;
+
+    /** 地址 */
+    @Excel(name = "地址")
+    @NotBlank(message = "地址不能为空")
+    private String address;
+
+    /** 删除状态 */
+    private String delFlag;
+
+    /** 产品配置id */
+    @Excel(name = "产品配置id")
+    private String configId;
+
+    /** 图片路径 */
+    @TableField(exist = false)
+    private String imgUrlList;
+
+    @TableField(exist = false)
+    private Integer imgType;
+
+}

+ 45 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/domain/JnbQuotationsConfig.java

@@ -0,0 +1,45 @@
+package com.sooka.jnb.quotations.domain;
+
+import lombok.Data;
+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 java.util.List;
+
+/**
+ * 行情产品配置对象 jnb_quotations_config
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@Data
+public class JnbQuotationsConfig extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键id */
+    private Long id;
+
+    /** 父级分类id */
+    private Long parentId;
+
+    /** 分类层级 */
+    private String level;
+
+    /** 图片路径 */
+    @Excel(name = "图片路径")
+    private String icon;
+
+    /** 是否首页展示 */
+    @Excel(name = "是否首页展示")
+    private String homeDisplay;
+
+    /** 产品名称 */
+    @Excel(name = "产品名称")
+    private String productName;
+
+    /** 子分类 */
+    private List<JnbQuotationsConfig> children;
+}

+ 18 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/domain/vo/JnbQuotationsTreeVO.java

@@ -0,0 +1,18 @@
+package com.sooka.jnb.quotations.domain.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author 刘浩男
+ */
+@Data
+public class JnbQuotationsTreeVO<T> implements Serializable {
+
+    /**
+     * 分类列表
+     */
+    private List<T> quotations;
+}

+ 66 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/mapper/JnbQuotationsConfigMapper.java

@@ -0,0 +1,66 @@
+package com.sooka.jnb.quotations.mapper;
+
+import com.sooka.jnb.quotations.domain.JnbQuotationsConfig;
+
+import java.util.List;
+
+/**
+ * 行情产品配置Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+public interface JnbQuotationsConfigMapper 
+{
+    /**
+     * 查询行情产品配置
+     * 
+     * @param id 行情产品配置主键
+     * @return 行情产品配置
+     */
+    public JnbQuotationsConfig selectJnbQuotationsConfigById(Long id);
+
+    /**
+     * 查询行情产品配置列表
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 行情产品配置集合
+     */
+    public List<JnbQuotationsConfig> selectJnbQuotationsConfigList(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 新增行情产品配置
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    public int insertJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 修改行情产品配置
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    public int updateJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig);
+
+
+    /**
+     * 批量删除行情产品配置
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteJnbQuotationsConfigByIds(Long id);
+
+    public List<JnbQuotationsConfig> selectAllQuotationsConfig(JnbQuotationsConfig jnbQuotations);
+
+    public int selectCount(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 查询是否有子级id
+     * @param id
+     * @return
+     */
+    public int selectJnbQuotationsConfigByParentId(Long id);
+}

+ 61 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/mapper/JnbQuotationsMapper.java

@@ -0,0 +1,61 @@
+package com.sooka.jnb.quotations.mapper;
+
+import com.sooka.jnb.quotations.domain.JnbQuotations;
+
+import java.util.List;
+
+/**
+ * 行情Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+public interface JnbQuotationsMapper 
+{
+    /**
+     * 查询行情
+     * 
+     * @param id 行情主键
+     * @return 行情
+     */
+    public JnbQuotations selectJnbQuotationsById(Long id);
+
+    /**
+     * 查询行情列表
+     * 
+     * @param jnbQuotations 行情
+     * @return 行情集合
+     */
+    public List<JnbQuotations> selectJnbQuotationsList(JnbQuotations jnbQuotations);
+
+    /**
+     * 校验行情是否唯一
+     * @param jnbQuotations
+     * @return
+     */
+    public int selectCount(JnbQuotations jnbQuotations);
+    /**
+     * 新增行情
+     * 
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    public int insertJnbQuotations(JnbQuotations jnbQuotations);
+
+    /**
+     * 修改行情
+     * 
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    public int updateJnbQuotations(JnbQuotations jnbQuotations);
+
+
+    /**
+     * 批量删除行情
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteJnbQuotationsByIds(Long[] ids);
+}

+ 58 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/service/IJnbQuotationsConfigService.java

@@ -0,0 +1,58 @@
+package com.sooka.jnb.quotations.service;
+
+import com.sooka.jnb.quotations.domain.JnbQuotationsConfig;
+import com.sooka.jnb.quotations.domain.vo.JnbQuotationsTreeVO;
+
+import java.util.List;
+
+/**
+ * 行情产品配置Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+public interface IJnbQuotationsConfigService 
+{
+    /**
+     * 查询行情产品配置
+     * 
+     * @param id 行情产品配置主键
+     * @return 行情产品配置
+     */
+    public JnbQuotationsConfig selectJnbQuotationsConfigById(Long id);
+
+    JnbQuotationsTreeVO<JnbQuotationsConfig> quotationsTree(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 查询行情产品配置列表
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 行情产品配置集合
+     */
+    public List<JnbQuotationsConfig> selectJnbQuotationsConfigList(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 新增行情产品配置
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    public int insertJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 修改行情产品配置
+     * 
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    public int updateJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig);
+
+    /**
+     * 批量删除行情产品配置
+     * 
+     * @param ids 需要删除的行情产品配置主键集合
+     * @return 结果
+     */
+    public int deleteJnbQuotationsConfigByIds(Long id);
+    
+}

+ 55 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/service/IJnbQuotationsService.java

@@ -0,0 +1,55 @@
+package com.sooka.jnb.quotations.service;
+
+import com.sooka.jnb.quotations.domain.JnbQuotations;
+
+import java.util.List;
+
+/**
+ * 行情Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+public interface IJnbQuotationsService 
+{
+    /**
+     * 查询行情
+     * 
+     * @param id 行情主键
+     * @return 行情
+     */
+    public JnbQuotations selectJnbQuotationsById(Long id,Integer type);
+
+    /**
+     * 查询行情列表
+     * 
+     * @param jnbQuotations 行情
+     * @return 行情集合
+     */
+    public List<JnbQuotations> selectJnbQuotationsList(JnbQuotations jnbQuotations);
+
+    /**
+     * 新增行情
+     * 
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    public int insertJnbQuotations(JnbQuotations jnbQuotations);
+
+    /**
+     * 修改行情
+     * 
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    public int updateJnbQuotations(JnbQuotations jnbQuotations);
+
+    /**
+     * 批量删除行情
+     * 
+     * @param ids 需要删除的行情主键集合
+     * @return 结果
+     */
+    public int deleteJnbQuotationsByIds(Long[] ids ,Integer type);
+
+}

+ 196 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/service/impl/JnbQuotationsConfigServiceImpl.java

@@ -0,0 +1,196 @@
+package com.sooka.jnb.quotations.service.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.sooka.jnb.quotations.domain.JnbQuotationsConfig;
+import com.sooka.jnb.quotations.domain.vo.JnbQuotationsTreeVO;
+import com.sooka.jnb.quotations.mapper.JnbQuotationsConfigMapper;
+import com.sooka.jnb.quotations.service.IJnbQuotationsConfigService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 行情产品配置Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@Service
+@Slf4j
+public class JnbQuotationsConfigServiceImpl implements IJnbQuotationsConfigService {
+
+    @Autowired
+    private JnbQuotationsConfigMapper jnbQuotationsConfigMapper;
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+
+    /**
+     * 查询行情产品配置
+     *
+     * @param id 行情产品配置主键
+     * @return 行情产品配置
+     */
+    @Override
+    public JnbQuotationsConfig selectJnbQuotationsConfigById(Long id) {
+        return jnbQuotationsConfigMapper.selectJnbQuotationsConfigById(id);
+    }
+
+    /**
+     * 三级分类树
+     */
+    @Override
+    public JnbQuotationsTreeVO<JnbQuotationsConfig> quotationsTree(JnbQuotationsConfig jnbQuotations) {
+//        //方法开始,先检查redis中是否包含这个key
+//        if (Boolean.TRUE.equals(redisTemplate.hasKey(QUOTATIONS_TREE))) {
+//            //如果包含,直接从redis中获取并返回
+//            return (JnbQuotationsTreeVO<JnbQuotationsConfig>) redisTemplate.opsForValue().get(QUOTATIONS_TREE);
+//        }
+        List<JnbQuotationsConfig> jnbQuotationsConfigs = jnbQuotationsConfigMapper.selectAllQuotationsConfig(jnbQuotations);
+        JnbQuotationsTreeVO<JnbQuotationsConfig> jnbQuotationsConfig = initTree(jnbQuotationsConfigs);
+//        redisTemplate.boundValueOps(QUOTATIONS_TREE).set(jnbQuotationsConfig, 1, TimeUnit.HOURS);
+        return jnbQuotationsConfig;
+    }
+
+    /**
+     * 树结构生成
+     * @param jnbQuotationsConfigs
+     * @return
+     */
+    private JnbQuotationsTreeVO initTree(List<JnbQuotationsConfig> jnbQuotationsConfigs) {
+        //创建一个map,map中使用父分类id作为key,遍历当前参数集合,将相同父分类id的对象存在一个key下
+        Map<Long, List<JnbQuotationsConfig>> map = new HashMap<>();
+        //遍历数据库中查询出来的所有分类对象
+        for (JnbQuotationsConfig jnbQuotationsConfig : jnbQuotationsConfigs) {
+            //因为后面会多次用到当前对象的父分类id,所以先取出来
+            Long parentId = jnbQuotationsConfig.getParentId();
+            //判断当前map中是否存在这个父分类id的key
+            if (map.containsKey(parentId)) {
+                //如果已经存在,直接将当前对象添加到这个key对应的list中
+                map.get(parentId).add(jnbQuotationsConfig);
+            } else {
+                //如果当前map中还没有这个key,就创建一个新的key-value元素
+                // 要先把value准备好,既实例化list,并将分类对象添加到集合中
+                List<JnbQuotationsConfig> list = new ArrayList<>();
+                list.add(jnbQuotationsConfig);
+                // 然后在map中新增元素
+                map.put(parentId, list);
+            }
+        }
+        //构建三级分类树,将子分类集合添加到对应的父分类对象的children属性中
+        List<JnbQuotationsConfig> firstLevels = map.get(0L);
+        //从一级分类开始,我们程序设计父分类为0的就是一级分类
+        if (firstLevels == null || firstLevels.isEmpty()) {
+            //判断fristLevels是否为null(或元素个数为0)
+            //必须先判空,否则容易出现空指针异常
+            throw new RuntimeException("行情产品配置数据异常");
+        }
+        for (JnbQuotationsConfig firstLevel : firstLevels) {
+            // 一级分类对象的id就是二级分类对象的父分类id
+            Long secondLevelParentId = firstLevel.getId();
+            // 根据二级分类的父分类id,获取当前分类包含的二级分类集合
+            List<JnbQuotationsConfig> secondLevels = map.get(secondLevelParentId);
+            //判断二级分类集合是否为null(或元素个数为0)
+            if (secondLevels == null || secondLevels.isEmpty()) {
+                //二级分类集合如果为null,不需要抛异常,只需在日志中输出警告即可
+                log.warn("{}号分类对象的二级分类没有内容", secondLevelParentId);
+                // 跳过当前循环,继续下一次循环
+                continue;
+            }
+            //二级分类铀元素,就便利二级分类对象
+            for (JnbQuotationsConfig secondLevel : secondLevels) {
+                Long thirdLevelParentId = secondLevel.getId();  //getId!!!!!
+                //根据三级分类的父分类id获取三级分类集合
+                List<JnbQuotationsConfig> thirdLevels = map.get(thirdLevelParentId);
+                //判断三级分类集合是否为null(或元素个数为0)
+                if (thirdLevels == null || thirdLevels.isEmpty()) {
+                    //三级分类集合如果为null,不需要抛日常,只需在日志中输出警告即可
+                    log.warn("{}号分类对象的三级分类没有内容", thirdLevelParentId);
+                    // 跳过当前循环,继续下一次循环
+                    continue;
+                }
+                // 将包含内容的三级分类集合赋值到二级分类对象的children属性中
+                secondLevel.setChildren(thirdLevels);
+            }
+            //内层循环结束,secondLevels中的每个元素,就都包含他的所有子分类对象了
+            // secondLevels赋值到一级分类对象oneLevel的children属性中
+            firstLevel.setChildren(secondLevels);
+        }
+        //循环结束后,所有的分类对象都包含自己对应的子分类集合了
+        //最后需要实例化FrontCategoryTreeVO对象,将firstLevels赋值给quotations属性
+        JnbQuotationsTreeVO jnbQuotationsTreeVO = new JnbQuotationsTreeVO();
+        jnbQuotationsTreeVO.setQuotations(firstLevels);
+        return jnbQuotationsTreeVO;
+    }
+
+    /**
+     * 查询行情产品配置列表
+     *
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 行情产品配置
+     */
+    @Override
+    public List<JnbQuotationsConfig> selectJnbQuotationsConfigList(JnbQuotationsConfig jnbQuotationsConfig) {
+        return jnbQuotationsConfigMapper.selectJnbQuotationsConfigList(jnbQuotationsConfig);
+    }
+
+    /**
+     * 新增行情产品配置
+     *
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    @Override
+    public int insertJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig) {
+        int i = jnbQuotationsConfigMapper.selectCount(jnbQuotationsConfig);
+        if (i > 0) {
+            return -1;
+        }
+        jnbQuotationsConfig.setCreateBy(SecurityUtils.getUsername());
+        jnbQuotationsConfig.setCreateTime(DateUtils.getNowDate());
+        return jnbQuotationsConfigMapper.insertJnbQuotationsConfig(jnbQuotationsConfig);
+    }
+
+    /**
+     * 修改行情产品配置
+     *
+     * @param jnbQuotationsConfig 行情产品配置
+     * @return 结果
+     */
+    @Override
+    public int updateJnbQuotationsConfig(JnbQuotationsConfig jnbQuotationsConfig) {
+        int i = jnbQuotationsConfigMapper.selectCount(jnbQuotationsConfig);
+        if (i > 0) {
+            return -1;
+        }
+        jnbQuotationsConfig.setUpdateBy(SecurityUtils.getUsername());
+        jnbQuotationsConfig.setUpdateTime(DateUtils.getNowDate());
+        return jnbQuotationsConfigMapper.updateJnbQuotationsConfig(jnbQuotationsConfig);
+    }
+
+    /**
+     * 批量删除行情产品配置
+     *
+     * @param ids 需要删除的行情产品配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteJnbQuotationsConfigByIds(Long id) {
+        int i = jnbQuotationsConfigMapper.selectJnbQuotationsConfigByParentId(id);
+        if (i > 0) {
+            return -1;
+        }
+        return jnbQuotationsConfigMapper.deleteJnbQuotationsConfigByIds(id);
+    }
+
+}

+ 145 - 0
sooka-jnb/src/main/java/com/sooka/jnb/quotations/service/impl/JnbQuotationsServiceImpl.java

@@ -0,0 +1,145 @@
+package com.sooka.jnb.quotations.service.impl;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.sooka.jnb.highServer.domain.JnbHighServerImg;
+import com.sooka.jnb.highServer.mapper.JnbHighServerImgMapper;
+import com.sooka.jnb.quotations.domain.JnbQuotations;
+import com.sooka.jnb.quotations.mapper.JnbQuotationsMapper;
+import com.sooka.jnb.quotations.service.IJnbQuotationsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * 行情Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-03-01
+ */
+@Service
+public class JnbQuotationsServiceImpl implements IJnbQuotationsService {
+
+    @Resource
+    private JnbQuotationsMapper jnbQuotationsMapper;
+
+    @Resource
+    private JnbHighServerImgMapper jnbHighServerImgMapper;
+
+    /**
+     * 查询行情
+     *
+     * @param id 行情主键
+     * @return 行情
+     */
+    @Override
+    public JnbQuotations selectJnbQuotationsById(Long id,Integer type) {
+        JnbQuotations jnbQuotations = jnbQuotationsMapper.selectJnbQuotationsById(id);
+        String s =jnbHighServerImgMapper.selectAll(id,type);
+        if (null != s) {
+            jnbQuotations.setImgUrlList(jnbHighServerImgMapper.selectAll(id,type));
+        }
+        return jnbQuotations;
+    }
+
+    /**
+     * 查询行情列表
+     *
+     * @param jnbQuotations 行情
+     * @return 行情
+     */
+    @Override
+    public List<JnbQuotations> selectJnbQuotationsList(JnbQuotations jnbQuotations) {
+        return jnbQuotationsMapper.selectJnbQuotationsList(jnbQuotations);
+    }
+
+    /**
+     * 新增行情
+     *
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    @Override
+    public int insertJnbQuotations(JnbQuotations jnbQuotations) {
+        int i = jnbQuotationsMapper.selectCount(jnbQuotations);
+        if (i > 0) {
+            return -1;
+        }
+        jnbQuotations.setCreateBy(SecurityUtils.getUserId().toString());
+        jnbQuotations.setCreateTime(DateUtils.getNowDate());
+        int insert = jnbQuotationsMapper.insertJnbQuotations(jnbQuotations);
+        if (insert > 0) {
+            List<String> imgUrlList = Arrays.asList(jnbQuotations.getImgUrlList().split(","));
+            if (!ObjectUtils.isEmpty(imgUrlList)) {
+                List<JnbHighServerImg> imgList = new ArrayList<>();
+                imgUrlList.forEach(a -> {
+                    JnbHighServerImg serverImg = new JnbHighServerImg();
+                    serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
+                    serverImg.setCreateTime(DateUtils.getNowDate());
+                    serverImg.setServerId(jnbQuotations.getId());
+                    serverImg.setImgUrl(a);
+                    serverImg.setType(13);
+                    imgList.add(serverImg);
+                });
+                jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
+            }
+        }
+        return insert;
+    }
+
+    /**
+     * 修改行情
+     *
+     * @param jnbQuotations 行情
+     * @return 结果
+     */
+    @Override
+    public int updateJnbQuotations(JnbQuotations jnbQuotations) {
+        jnbQuotations.setUpdateBy(SecurityUtils.getUsername());
+        jnbQuotations.setUpdateTime(DateUtils.getNowDate());
+        img(jnbQuotations.getImgUrlList(), jnbHighServerImgMapper, jnbQuotations.getId(), jnbQuotations);
+        return jnbQuotationsMapper.updateJnbQuotations(jnbQuotations);
+    }
+
+    public static void img(String imgUrlList2, JnbHighServerImgMapper jnbHighServerImgMapper, Long id, JnbQuotations jnbQuotations) {
+        List<String> imgUrlList = Arrays.asList(imgUrlList2.split(","));
+        if (!ObjectUtils.isEmpty(imgUrlList)) {
+            List<JnbHighServerImg> imgList = new ArrayList<>();
+            jnbHighServerImgMapper.deleteJnbHighServerByServerId(id,13);
+            imgUrlList.forEach(a -> {
+                JnbHighServerImg serverImg = new JnbHighServerImg();
+                serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
+                serverImg.setCreateTime(DateUtils.getNowDate());
+                serverImg.setServerId(id);
+                serverImg.setImgUrl(a);
+                serverImg.setType(13);
+                imgList.add(serverImg);
+            });
+            jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
+        }
+    }
+
+    /**
+     * 批量删除行情
+     *
+     * @param ids 需要删除的行情主键
+     * @return 结果
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int deleteJnbQuotationsByIds(Long[] ids,Integer type) {
+        int i = jnbQuotationsMapper.deleteJnbQuotationsByIds(ids);
+        if (i > 0) {
+            jnbHighServerImgMapper.deleteJnbHighServerByServerIds(ids,type);
+        }
+        return i;
+    }
+
+}

+ 93 - 0
sooka-jnb/src/main/resources/mapper/quotations/JnbQuotationsConfigMapper.xml

@@ -0,0 +1,93 @@
+<?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.sooka.jnb.quotations.mapper.JnbQuotationsConfigMapper">
+    
+    <resultMap type="JnbQuotationsConfig" id="JnbQuotationsConfigResult">
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="id"    column="id"    />
+        <result property="icon"    column="icon"    />
+        <result property="homeDisplay"    column="home_display"    />
+        <result property="productName"    column="product_name"    />
+    </resultMap>
+
+    <sql id="selectJnbQuotationsConfigVo">
+        select id,parent_id,level, product_name , home_display , icon from jnb_quotations_config
+    </sql>
+
+    <select id="selectJnbQuotationsConfigList" parameterType="JnbQuotationsConfig" resultMap="JnbQuotationsConfigResult">
+        <include refid="selectJnbQuotationsConfigVo"/>
+        <where>  
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            and del_flag = 0
+        </where>
+    </select>
+    
+    <select id="selectJnbQuotationsConfigById" parameterType="Long" resultMap="JnbQuotationsConfigResult">
+        <include refid="selectJnbQuotationsConfigVo"/>
+        where id = #{id}
+        and del_flag = 0
+    </select>
+        
+    <insert id="insertJnbQuotationsConfig" parameterType="JnbQuotationsConfig">
+        insert into jnb_quotations_config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="icon != null">icon,</if>
+            <if test="parentId != null">parent_id,</if>
+            <if test="level != null">level,</if>
+            <if test="homeDisplay != null">home_display,</if>
+            <if test="productName != null">product_name,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="icon != null">#{icon},</if>
+            <if test="parentId != null">#{parentId},</if>
+            <if test="level != null">#{level},</if>
+            <if test="homeDisplay != null">#{homeDisplay},</if>
+            <if test="productName != null">#{productName},</if>
+         </trim>
+    </insert>
+
+    <update id="updateJnbQuotationsConfig" parameterType="JnbQuotationsConfig">
+        update jnb_quotations_config
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="icon != null">icon = #{icon},</if>
+            <if test="homeDisplay != null">home_display = #{homeDisplay},</if>
+            <if test="productName != null">product_name = #{productName},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+
+    <update id="deleteJnbQuotationsConfigByIds" parameterType="Long">
+        update  jnb_quotations_config
+        SET del_flag = 1
+        where id =#{id}
+    </update>
+
+    <select id="selectAllQuotationsConfig" resultMap="JnbQuotationsConfigResult">
+        <include refid="selectJnbQuotationsConfigVo"/>
+        <where>
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            and del_flag = 0
+        </where>
+    </select>
+
+    <select id="selectCount" resultType="java.lang.Integer">
+        select count(1) from jnb_quotations_config
+        <where>
+            and del_flag = 0
+            <if test="productName != null  and productName != ''"> and product_name =#{productName}</if>
+            <if test="level != null  and level != ''"> and level = #{level}</if>
+        </where>
+    </select>
+
+    <select id="selectJnbQuotationsConfigByParentId" resultType="java.lang.Integer">
+        select count(1) from jnb_quotations_config
+        where parent_id = #{parentId}
+        and del_flag = 0
+    </select>
+</mapper>

+ 105 - 0
sooka-jnb/src/main/resources/mapper/quotations/JnbQuotationsMapper.xml

@@ -0,0 +1,105 @@
+<?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.sooka.jnb.quotations.mapper.JnbQuotationsMapper">
+    
+    <resultMap type="JnbQuotations" id="JnbQuotationsResult">
+        <result property="id"    column="id"    />
+        <result property="productName"    column="product_name"    />
+        <result property="area"    column="area"    />
+        <result property="type"    column="type"    />
+        <result property="price"    column="price"    />
+        <result property="phone"    column="phone"    />
+        <result property="address"    column="address"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectJnbQuotationsVo">
+        select id, product_name, area, type, price, phone, address, create_by, create_time, del_flag from jnb_quotations
+    </sql>
+
+    <select id="selectJnbQuotationsList" parameterType="JnbQuotations" resultMap="JnbQuotationsResult">
+        <include refid="selectJnbQuotationsVo"/>
+        <where>  
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            <if test="area != null  and area != ''"> and area = #{area}</if>
+             and del_flag = 0
+        </where>
+    </select>
+
+    <select id="selectCount" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM jnb_quotations
+        WHERE product_name = #{productName}
+        AND type = #{type};
+    </select>
+
+    <select id="selectJnbQuotationsById" parameterType="Long" resultMap="JnbQuotationsResult">
+        <include refid="selectJnbQuotationsVo"/>
+        where
+        id = #{id}
+        and del_flag = 0
+    </select>
+        
+    <insert id="insertJnbQuotations" parameterType="JnbQuotations" useGeneratedKeys="true" keyProperty="id">
+        insert into jnb_quotations
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productName != null">product_name,</if>
+            <if test="area != null">area,</if>
+            <if test="type != null">type,</if>
+            <if test="price != null">price,</if>
+            <if test="phone != null">phone,</if>
+            <if test="address != null">address,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="delFlag != null">del_flag,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="productName != null">#{productName},</if>
+            <if test="area != null">#{area},</if>
+            <if test="type != null">#{type},</if>
+            <if test="price != null">#{price},</if>
+            <if test="phone != null">#{phone},</if>
+            <if test="address != null">#{address},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+        </trim>
+    </insert>
+
+    <update id="updateJnbQuotations" parameterType="JnbQuotations">
+        update jnb_quotations
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="productName != null">product_name = #{productName},</if>
+            <if test="area != null">area = #{area},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="price != null">price = #{price},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteJnbQuotationsByIds" parameterType="String">
+        update  jnb_quotations
+        set del_flag = 1
+        where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>