From 2b718717437184573b8575d62996d4be5c67a628 Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Thu, 7 Mar 2024 13:03:14 +0800 Subject: [PATCH] '111' --- pom.xml | 2 +- .../clMaterial/CYlMaterialController.java | 20 +++++++++++ .../src/main/resources/application-druid.yml | 13 ++++++- .../ruoyi/common/enums/DataSourceType.java | 7 +++- .../ruoyi/framework/config/DruidConfig.java | 10 ++++++ .../clMaterial/mapper/CYlMaterialMapper.java | 18 ++++++++++ .../service/ICYlMaterialService.java | 18 ++++++++++ .../service/impl/CYlMaterialServiceImpl.java | 31 +++++++++++++++++ .../mapper/clMaterial/CYlMaterialMapper.xml | 34 +++++++++++++++++++ ruoyi-ui/src/api/clMaterial/clMaterial.js | 8 +++++ .../src/views/clMaterial/clMaterial/index.vue | 22 +++++++++++- .../src/views/material/material/index.vue | 4 +-- 12 files changed, 181 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 9646f35..d81cf9e 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ UTF-8 1.8 3.1.1 - 1.2.20 + 1.2.21 1.21 3.0.0 2.3.3 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/clMaterial/CYlMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/clMaterial/CYlMaterialController.java index 2b9a735..716489d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/clMaterial/CYlMaterialController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/clMaterial/CYlMaterialController.java @@ -109,4 +109,24 @@ public class CYlMaterialController extends BaseController { return toAjax(cYlMaterialService.deleteCYlMaterialByMaterialIds(materialIds)); } + + /** + * 同步更细报价实时价格 + */ + @PreAuthorize("@ss.hasPermi('clMaterial:clMaterial:synchronizeQuotationData')") + @Log(title = "同步更细报价实时价格", businessType = BusinessType.UPDATE) + @DataSource(DataSourceType.JNERP) + @PostMapping("/synchronizeUpdate") + public AjaxResult synchronizeUpdate() + { + //拉取9.2 jn_erp 报价实时价格数据,保存至 c_yl_material_bjdata 表 + List list = cYlMaterialService.getBjData(); + cYlMaterialService.deleteYlMaterialBjBatch(); + cYlMaterialService.insertYlMaterialBjBatch(list); + + //数据执行sql 更新 c_yl_material_bjdata 表中单价字段 + + + return success(); + } } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index b962313..85f3d94 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -22,9 +22,20 @@ spring: # 从数据源开关/默认关闭 enabled: true driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver - url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot + # 测试数据库 + url: jdbc:sqlserver://192.168.9.66:1433;DatabaseName=jn_quot + # 正式数据库 + # url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot username: sa password: Itcenter110- + # 江南erp数据库数据源 + jnerp: + # 从数据源开关/默认关闭 + enabled: true + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + url: jdbc:sqlserver://192.168.9.2:1433;DatabaseName=jn_erp + username: sa + password: it12345 # 初始连接数 initialSize: 10 # 最小连接池数量 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java index 16bc447..c4c19ce 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java @@ -20,6 +20,11 @@ public enum DataSourceType /** * 江南全要素报价数据库 */ - QUOT + QUOT, + + /** + * 江南ERP数据库 + */ + JNERP } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java index cf7ff2c..1fdc2f8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -58,6 +58,15 @@ public class DruidConfig return druidProperties.dataSource(dataSource); } + @Bean + @ConfigurationProperties("spring.datasource.druid.jnerp") + @ConditionalOnProperty(prefix = "spring.datasource.druid.jnerp", name = "enabled", havingValue = "true") + public DataSource jnerpDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + @Bean(name = "dynamicDataSource") @Primary public DynamicDataSource dataSource(DataSource masterDataSource) @@ -66,6 +75,7 @@ public class DruidConfig targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource"); setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource"); + setDataSource(targetDataSources, DataSourceType.JNERP.name(), "jnerpDataSource"); return new DynamicDataSource(masterDataSource, targetDataSources); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/mapper/CYlMaterialMapper.java b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/mapper/CYlMaterialMapper.java index 7131cd5..f22a332 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/mapper/CYlMaterialMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/mapper/CYlMaterialMapper.java @@ -65,4 +65,22 @@ public interface CYlMaterialMapper * @return 结果 */ CYlMaterial checkMaterialNoUnique(String materialNo); + + /** + * 拉取报价实时价格数据 + * @return + */ + List getBjData(); + + /** + * 删除c_yl_material_bjdata 表数据 + */ + void deleteYlMaterialBjBatch(); + + /** + * 报价实时价格数据保存至 c_yl_material_bjdata 表 + * @param list + */ + void insertYlMaterialBjBatch(List list); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/ICYlMaterialService.java b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/ICYlMaterialService.java index 38c66ff..fbded89 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/ICYlMaterialService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/ICYlMaterialService.java @@ -65,4 +65,22 @@ public interface ICYlMaterialService * @return */ boolean checkMaterialNoUnique(CYlMaterial cYlMaterial); + + /** + * 拉取报价实时价格数据 + * @return + */ + List getBjData(); + + /** + * 删除c_yl_material_bjdata 表数据 + */ + void deleteYlMaterialBjBatch(); + + /** + * 报价实时价格数据保存至 c_yl_material_bjdata 表 + * @param list + */ + void insertYlMaterialBjBatch(List list); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/impl/CYlMaterialServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/impl/CYlMaterialServiceImpl.java index 430cfab..3042a1c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/impl/CYlMaterialServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/clMaterial/service/impl/CYlMaterialServiceImpl.java @@ -2,8 +2,10 @@ package com.ruoyi.clMaterial.service.impl; import java.util.List; +import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -110,4 +112,33 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService } return UserConstants.UNIQUE; } + + /** + * 拉取报价实时价格数据 + * @return + */ + @Override + public List getBjData() { + + List list = cYlMaterialMapper.getBjData(); + System.out.println(list); + return null; + } + + /** + * 删除c_yl_material_bjdata 表数据 + */ + @Override + public void deleteYlMaterialBjBatch() { + cYlMaterialMapper.deleteYlMaterialBjBatch(); + } + + /** + * 报价实时价格数据保存至 c_yl_material_bjdata 表 + * @param list + */ + @Override + public void insertYlMaterialBjBatch(List list) { + cYlMaterialMapper.insertYlMaterialBjBatch(list); + } } diff --git a/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml b/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml index c806a71..0b38a42 100644 --- a/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml @@ -72,4 +72,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo} + + + + delete from c_yl_material_bjdata + + + + INSERT INTO c_yl_material_bjdata (material_no, material_name, material_price) + VALUES + + (#{t.materialNo,jdbcType=VARCHAR}, + #{t.materialName,jdbcType=VARCHAR}, + #{t.materialPrice,jdbcType=DECIMAL}) + + + diff --git a/ruoyi-ui/src/api/clMaterial/clMaterial.js b/ruoyi-ui/src/api/clMaterial/clMaterial.js index e463f66..7137e6d 100644 --- a/ruoyi-ui/src/api/clMaterial/clMaterial.js +++ b/ruoyi-ui/src/api/clMaterial/clMaterial.js @@ -42,3 +42,11 @@ export function delClMaterial(materialId) { method: 'delete' }) } + +//同步更细报价实时价格 +export function synchronizeUpdate() { + return request({ + url: '/clMaterial/clMaterial/synchronizeUpdate', + method: 'post' + }) +} diff --git a/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue b/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue index 7231caf..75f765e 100644 --- a/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue +++ b/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue @@ -76,6 +76,16 @@ v-hasPermi="['clMaterial:clMaterial:export']" >导出 + + 同步更新报价 + @@ -150,7 +160,7 @@