From 0179891d082964019cd77dc39fafbc1eb9d1c8ec Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Sun, 12 May 2024 14:09:48 +0800 Subject: [PATCH] '123' --- .../controller/monitor/CacheController.java | 1 + .../controller/redBook/RedBookController.java | 61 ++++++++++++++++ .../ruoyi/common/constant/CacheConstants.java | 5 ++ .../ruoyi/redBook/domain/OAQuotProduct.java | 45 ++++-------- .../redBook/domain/RbVersionDateResult.java | 22 ++++++ .../ruoyi/redBook/mapper/OARedBookMapper.java | 14 ++++ .../redBook/service/IRedBookService.java | 16 +++++ .../service/impl/RedBookServiceImpl.java | 20 ++++++ .../mapper/redBook/OARedBookMapper.xml | 28 +++++++- ruoyi-ui/src/api/redBook/redBook.js | 18 +++++ ruoyi-ui/src/views/redBook/productSelect.vue | 70 ++++++++++++++++--- 11 files changed, 260 insertions(+), 40 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/redBook/domain/RbVersionDateResult.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index 8128c65..eca9778 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -46,6 +46,7 @@ public class CacheController caches.add(new SysCache(CacheConstants.SYS_JOB_KEY, "定时任务")); caches.add(new SysCache(CacheConstants.SAP_COMMON, "SAP公共数据")); + caches.add(new SysCache(CacheConstants.RB_VERSION_DATE, "调价版本")); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java index 2b0d334..5d51978 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java @@ -2,17 +2,27 @@ package com.ruoyi.web.controller.redBook; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.UUID; +import com.ruoyi.customer.domain.Customer; +import com.ruoyi.quote.domain.CalculateRBParamDto; +import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.OAQuot; +import com.ruoyi.redBook.domain.RbVersionDateResult; import com.ruoyi.redBook.service.IRedBookService; import com.ruoyi.web.utils.IdUtils; +import com.ruoyi.web.utils.SapFunction.RfcResult; +import com.ruoyi.web.utils.SapFunction.SapRfcUtils; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; @@ -31,6 +41,9 @@ public class RedBookController extends BaseController @Autowired private IRedBookService redBookService; + @Autowired + private RedisCache redisCache; + /** * 获取目录 * @param product @@ -192,6 +205,11 @@ public class RedBookController extends BaseController return list; } + /** + * 报价单生成 + * @param quot + * @return + */ @DataSource(DataSourceType.MASTER) @Log(title = "报价单生成", businessType = BusinessType.OTHER) @PostMapping("/madeQuot") @@ -203,4 +221,47 @@ public class RedBookController extends BaseController redBookService.insertOAQuot(quot); return success(); } + /** + * 获取调价日期 + * @param oAQuot + * @return + */ + @DataSource(DataSourceType.OAREDBOOK) + @GetMapping("/versionList") + public AjaxResult versionList(OAQuot oAQuot) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getCacheKey("versionList")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = redBookService.versionList(); + redisCache.setCacheObject(getCacheKey("versionList"),resCache); + } + ajax.put("versionList", resCache); + return ajax; + } + + /** + * 获取redis 调价日期 + * @param type + * @return + */ + private String getCacheKey(String type) + { + return CacheConstants.RB_VERSION_DATE + type; + } + + /** + * 根据选择的调价日期 更新已选择结果数据 + * @param params + * @return + */ + @DataSource(DataSourceType.OAREDBOOK) + @PostMapping("/updateSelectedResultData") + public AjaxResult updateSelectedResultData(@RequestBody List params) + { + List oaQuotProducts = redBookService.queryRedBPriceByParams(params); + logger.info("根据选择的调价日期 匹配数据结果: {}", oaQuotProducts); + return success(oaQuotProducts); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 49daa9d..d2b2a48 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -56,4 +56,9 @@ public class CacheConstants * SAP-公共数据 redis key */ public static final String SAP_COMMON = "sap_common:"; + + /** + * 调价日期数据 redis key + */ + public static final String RB_VERSION_DATE = "rb_version_date:"; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java index 8e76678..48d2575 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java @@ -3,6 +3,7 @@ package com.ruoyi.redBook.domain; import java.math.BigDecimal; public class OAQuotProduct { + private String uid_0;//版本uid private String name_0;//型号 private String spec;//规格 private String voltage;//电压 @@ -13,6 +14,10 @@ public class OAQuotProduct { private String quot_product_id;//id private String quot_id;//报价单id + public String getUid_0() { return uid_0; } + + public void setUid_0(String uid_0) { this.uid_0 = uid_0; } + public String getName_0() { return name_0; } @@ -45,43 +50,23 @@ public class OAQuotProduct { this.stu = stu; } - public BigDecimal getSetPrice() { - return setPrice; - } + public BigDecimal getSetPrice() { return setPrice; } - public void setSetPrice(BigDecimal setPrice) { - this.setPrice = setPrice; - } + public void setSetPrice(BigDecimal setPrice) { this.setPrice = setPrice; } - public BigDecimal getCount() { - return count; - } + public BigDecimal getCount() { return count; } - public void setCount(BigDecimal count) { - this.count = count; - } + public void setCount(BigDecimal count) { this.count = count; } - public BigDecimal getAllPrice() { - return allPrice; - } + public BigDecimal getAllPrice() { return allPrice; } - public void setAllPrice(BigDecimal allPrice) { - this.allPrice = allPrice; - } + public void setAllPrice(BigDecimal allPrice) { this.allPrice = allPrice; } - public String getQuot_product_id() { - return quot_product_id; - } + public String getQuot_product_id() { return quot_product_id; } - public void setQuot_product_id(String quot_product_id) { - this.quot_product_id = quot_product_id; - } + public void setQuot_product_id(String quot_product_id) { this.quot_product_id = quot_product_id; } - public String getQuot_id() { - return quot_id; - } + public String getQuot_id() { return quot_id; } - public void setQuot_id(String quot_id) { - this.quot_id = quot_id; - } + public void setQuot_id(String quot_id) { this.quot_id = quot_id; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/RbVersionDateResult.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/RbVersionDateResult.java new file mode 100644 index 0000000..2bbfb89 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/RbVersionDateResult.java @@ -0,0 +1,22 @@ +package com.ruoyi.redBook.domain; + +public class RbVersionDateResult { + private String value; + private String label; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java index 405466a..254d63f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java @@ -6,6 +6,7 @@ import com.ruoyi.material.domain.temp; import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.Product; +import com.ruoyi.redBook.domain.RbVersionDateResult; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -86,4 +87,17 @@ public interface OARedBookMapper * @param list */ void batchOAQuotProduct(List list); + + /** + * 获取调价日期 + * @return + */ + List versionList(); + + /** + * 根据选择的调价日期 更新已选择结果数据 + * @param params + * @return + */ + List queryRedBPriceByParams(@Param("params") List params); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java index 929a787..2ad78d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java @@ -2,8 +2,11 @@ package com.ruoyi.redBook.service; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.quote.domain.CalculateRBParamDto; import com.ruoyi.redBook.domain.OAQuot; +import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.Product; +import com.ruoyi.redBook.domain.RbVersionDateResult; import java.util.List; @@ -77,4 +80,17 @@ public interface IRedBookService * @param quot */ void insertOAQuot(OAQuot quot); + + /** + * 获取调价日期 + * @return + */ + List versionList(); + + /** + * 根据选择的调价日期 更新已选择结果数据 + * @param params + * @return + */ + List queryRedBPriceByParams(List params); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java index 27e8d4b..2e39e62 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java @@ -8,6 +8,7 @@ import com.ruoyi.customer.domain.Customer; import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.Product; +import com.ruoyi.redBook.domain.RbVersionDateResult; import com.ruoyi.redBook.mapper.OARedBookMapper; import com.ruoyi.redBook.service.IRedBookService; import org.springframework.beans.factory.annotation.Autowired; @@ -146,4 +147,23 @@ public class RedBookServiceImpl implements IRedBookService } } } + + /** + * 获取调价日期 + * @return + */ + @Override + public List versionList() { + return oaRedBookMapper.versionList(); + } + + /** + * 根据选择的调价日期 更新已选择结果数据 + * @param params + * @return + */ + @Override + public List queryRedBPriceByParams(List params) { + return oaRedBookMapper.queryRedBPriceByParams(params); + } } diff --git a/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml b/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml index 1510bfe..7d58cf7 100644 --- a/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml @@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select uid_0 value, + convert(varchar(10),[date_0],23)+' 铜:'+convert(varchar(10),[tong_price_0])+' 铝:'+convert(varchar(10),[lv_price_0]) label + from [rb_productVersion] A + inner join (select max(uid_0) muid from rb_productVersion + where sta_0=1 or sta_0=0 group by date_0 )B on A.uid_0=B.muid + order by sta_0 desc,uid_0 desc + + + + diff --git a/ruoyi-ui/src/api/redBook/redBook.js b/ruoyi-ui/src/api/redBook/redBook.js index ef2b0aa..5b89453 100644 --- a/ruoyi-ui/src/api/redBook/redBook.js +++ b/ruoyi-ui/src/api/redBook/redBook.js @@ -108,6 +108,24 @@ export function madeQuot(data) { data: data }) } +//获取调价日期 +export function versionList(query) { + return request({ + url: '/redBook/redBook/versionList', + method: 'get', + params: query + }) +} +//根据选择的调价日期 更新已选择结果数据 +export function updateSelectedResultData(data) { + return request({ + url: '/redBook/redBook/updateSelectedResultData', + method: 'post', + data: data + }) +} + + diff --git a/ruoyi-ui/src/views/redBook/productSelect.vue b/ruoyi-ui/src/views/redBook/productSelect.vue index c82ca74..6104138 100644 --- a/ruoyi-ui/src/views/redBook/productSelect.vue +++ b/ruoyi-ui/src/views/redBook/productSelect.vue @@ -50,11 +50,11 @@ - + - - + + 总价:{{sumSelectedResultData}} + + + - + + - + - +