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 716489d..41b4ec3 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 @@ -115,17 +115,18 @@ public class CYlMaterialController extends BaseController */ @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); + if(list!=null&&list.size()>0){ + cYlMaterialService.deleteYlMaterialBjBatch(); + cYlMaterialService.insertYlMaterialBjBatch(list); + } //数据执行sql 更新 c_yl_material_bjdata 表中单价字段 - + cYlMaterialService.updateYlMaterialBjBatch(); return success(); } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 85f3d94..ccbd973 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -23,9 +23,9 @@ spring: enabled: true driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # 测试数据库 - url: jdbc:sqlserver://192.168.9.66: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 + url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot username: sa password: Itcenter110- # 江南erp数据库数据源 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 f22a332..28b3fb9 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 @@ -83,4 +83,8 @@ public interface CYlMaterialMapper */ void insertYlMaterialBjBatch(List list); + /** + * 更新 c_yl_material_bjdata 表中单价字段 + */ + void updateYlMaterialBjBatch(); } 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 fbded89..4ddb88b 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 @@ -83,4 +83,8 @@ public interface ICYlMaterialService */ void insertYlMaterialBjBatch(List list); + /** + * 更新 c_yl_material_bjdata 表中单价字段 + */ + void updateYlMaterialBjBatch(); } 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 3042a1c..c816c6b 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 @@ -118,17 +118,18 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService * @return */ @Override + @DataSource(DataSourceType.JNERP) public List getBjData() { List list = cYlMaterialMapper.getBjData(); - System.out.println(list); - return null; + return list; } /** * 删除c_yl_material_bjdata 表数据 */ @Override + @DataSource(DataSourceType.QUOT) public void deleteYlMaterialBjBatch() { cYlMaterialMapper.deleteYlMaterialBjBatch(); } @@ -138,7 +139,17 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService * @param list */ @Override + @DataSource(DataSourceType.QUOT) public void insertYlMaterialBjBatch(List list) { cYlMaterialMapper.insertYlMaterialBjBatch(list); } + + /** + * 更新 c_yl_material_bjdata 表中单价字段 + */ + @Override + @DataSource(DataSourceType.QUOT) + public void updateYlMaterialBjBatch() { + cYlMaterialMapper.updateYlMaterialBjBatch(); + } } diff --git a/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml b/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml index 0b38a42..8cbf677 100644 --- a/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/clMaterial/CYlMaterialMapper.xml @@ -97,13 +97,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - INSERT INTO c_yl_material_bjdata (material_no, material_name, material_price) + INSERT INTO c_yl_material_bjdata (material_bj_no, material_bj_name, material_bj_price) VALUES (#{t.materialNo,jdbcType=VARCHAR}, #{t.materialName,jdbcType=VARCHAR}, - #{t.materialPrice,jdbcType=DECIMAL}) + cast(#{t.materialPrice,jdbcType=DECIMAL} as decimal(18,2))) + + update c_yl_material set material_name = a.material_bj_name,material_price=a.material_bj_price + from c_yl_material_bjdata a where a.material_bj_no = material_no +