From 02d1c9cdce8a894cfed41517b1c6fa59dc32f595 Mon Sep 17 00:00:00 2001 From: JIAL <2287346125@qq.com> Date: Fri, 15 Mar 2024 09:21:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/quote/QuoteController.java | 18 +++++--- .../com/ruoyi/quote/mapper/QuoteMapper.java | 3 +- .../com/ruoyi/quote/service/QuoteService.java | 3 +- .../quote/service/impl/QuoteServiceImpl.java | 9 ++-- .../resources/mapper/quote/QuoteMapper.xml | 9 ++-- ruoyi-ui/src/api/quote/quote.js | 6 ++- ruoyi-ui/src/views/quotePage/quote/index.vue | 41 ++++++++----------- 7 files changed, 48 insertions(+), 41 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quote/QuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quote/QuoteController.java index f1caaa4..cbae96e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quote/QuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quote/QuoteController.java @@ -12,7 +12,12 @@ import com.ruoyi.quote.service.QuoteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; +import java.util.Map; import static com.ruoyi.common.utils.PageUtils.startPage; @@ -87,16 +92,19 @@ public class QuoteController extends BaseController { } /** - * @title queryRedBookVersion - * @description 获取红本版本号 + * @title queryRedBookInfo + * @description 获取红本信息,包括版本号、铜价和铝价 * @author JIAL * @updateTime 2024/3/11 11:24 * @return: com.ruoyi.common.core.domain.AjaxResult */ @DataSource(DataSourceType.REDBOOK) - @PostMapping("/redBookVer") - public AjaxResult queryRedBookVersion() { - return success(quoteService.queryRedBookVer()); + @PostMapping("/redBookInfo") + public AjaxResult queryRedBookInfo() throws ParseException { + logger.info("开始记录"); + Map resultMap = quoteService.queryRedBookInfo(); + logger.info(resultMap.toString()); + return success(resultMap); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/quote/mapper/QuoteMapper.java b/ruoyi-system/src/main/java/com/ruoyi/quote/mapper/QuoteMapper.java index 2b65bc6..8309f97 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quote/mapper/QuoteMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quote/mapper/QuoteMapper.java @@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; +import java.util.Map; /** * @ClassName QuoteMapper @@ -24,7 +25,7 @@ public interface QuoteMapper { List queryRedBPriceByParams(@Param("params") List params); - String queryRedBookVer(); + Map queryRedBookInfo(); String queryRedBookLocalVer(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/quote/service/QuoteService.java b/ruoyi-system/src/main/java/com/ruoyi/quote/service/QuoteService.java index e2b3596..a322bfa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quote/service/QuoteService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quote/service/QuoteService.java @@ -4,6 +4,7 @@ import com.ruoyi.quote.domain.CalculateRBParamDto; import com.ruoyi.quote.domain.MaterialDto; import java.util.List; +import java.util.Map; /** * @ClassName QuoteService @@ -19,7 +20,7 @@ public interface QuoteService { List queryRedBPriceByParams(List params); - String queryRedBookVer(); + Map queryRedBookInfo(); String queryRedBookLocalVer(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/quote/service/impl/QuoteServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/quote/service/impl/QuoteServiceImpl.java index c05553a..0276af6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quote/service/impl/QuoteServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quote/service/impl/QuoteServiceImpl.java @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; /** * @ClassName QuoteServiceImpl @@ -65,15 +66,15 @@ public class QuoteServiceImpl implements QuoteService { /** - * @title queryRedBookVer - * @description 获取红本价最新版本 + * @title queryRedBookInfo + * @description 获取红本信息,包括版本号、铜价和铝价 * @author JIAL * @updateTime 2024/3/11 11:13 * @return: java.lang.String */ @Override - public String queryRedBookVer() { - return quoteMapper.queryRedBookVer(); + public Map queryRedBookInfo() { + return quoteMapper.queryRedBookInfo(); } /** diff --git a/ruoyi-system/src/main/resources/mapper/quote/QuoteMapper.xml b/ruoyi-system/src/main/resources/mapper/quote/QuoteMapper.xml index f79bcf9..99e5ebd 100644 --- a/ruoyi-system/src/main/resources/mapper/quote/QuoteMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/quote/QuoteMapper.xml @@ -103,10 +103,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND a.电压等级 = v.电压等级; - + SELECT t.uid_0 AS uid, t.date_0 AS currAdjDate, t.tong_price_0 AS currCopperPrice, t.lv_price_0 AS currAlumPrice + FROM [RedBook].[dbo].[rb_productVersion] t + WHERE [sta_0] IN ('0', '1') + AND t.uid_0 = (SELECT MAX(uid_0) FROM [RedBook].[dbo].[rb_productVersion] WHERE [sta_0] IN ('0', '1'))