'同步更新材料表'

This commit is contained in:
xd 2024-03-07 13:58:54 +08:00
parent 61bc95f676
commit ae1c303ed9
6 changed files with 34 additions and 10 deletions

View File

@ -115,17 +115,18 @@ public class CYlMaterialController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('clMaterial:clMaterial:synchronizeQuotationData')") @PreAuthorize("@ss.hasPermi('clMaterial:clMaterial:synchronizeQuotationData')")
@Log(title = "同步更细报价实时价格", businessType = BusinessType.UPDATE) @Log(title = "同步更细报价实时价格", businessType = BusinessType.UPDATE)
@DataSource(DataSourceType.JNERP)
@PostMapping("/synchronizeUpdate") @PostMapping("/synchronizeUpdate")
public AjaxResult synchronizeUpdate() public AjaxResult synchronizeUpdate()
{ {
//拉取9.2 jn_erp 报价实时价格数据,保存至 c_yl_material_bjdata //拉取9.2 jn_erp 报价实时价格数据,保存至 c_yl_material_bjdata
List<CYlMaterial> list = cYlMaterialService.getBjData(); List<CYlMaterial> list = cYlMaterialService.getBjData();
if(list!=null&&list.size()>0){
cYlMaterialService.deleteYlMaterialBjBatch(); cYlMaterialService.deleteYlMaterialBjBatch();
cYlMaterialService.insertYlMaterialBjBatch(list); cYlMaterialService.insertYlMaterialBjBatch(list);
}
//数据执行sql 更新 c_yl_material_bjdata 表中单价字段 //数据执行sql 更新 c_yl_material_bjdata 表中单价字段
cYlMaterialService.updateYlMaterialBjBatch();
return success(); return success();
} }

View File

@ -23,9 +23,9 @@ spring:
enabled: true enabled: true
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 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 username: sa
password: Itcenter110- password: Itcenter110-
# 江南erp数据库数据源 # 江南erp数据库数据源

View File

@ -83,4 +83,8 @@ public interface CYlMaterialMapper
*/ */
void insertYlMaterialBjBatch(List<CYlMaterial> list); void insertYlMaterialBjBatch(List<CYlMaterial> list);
/**
* 更新 c_yl_material_bjdata 表中单价字段
*/
void updateYlMaterialBjBatch();
} }

View File

@ -83,4 +83,8 @@ public interface ICYlMaterialService
*/ */
void insertYlMaterialBjBatch(List<CYlMaterial> list); void insertYlMaterialBjBatch(List<CYlMaterial> list);
/**
* 更新 c_yl_material_bjdata 表中单价字段
*/
void updateYlMaterialBjBatch();
} }

View File

@ -118,17 +118,18 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService
* @return * @return
*/ */
@Override @Override
@DataSource(DataSourceType.JNERP)
public List<CYlMaterial> getBjData() { public List<CYlMaterial> getBjData() {
List<CYlMaterial> list = cYlMaterialMapper.getBjData(); List<CYlMaterial> list = cYlMaterialMapper.getBjData();
System.out.println(list); return list;
return null;
} }
/** /**
* 删除c_yl_material_bjdata 表数据 * 删除c_yl_material_bjdata 表数据
*/ */
@Override @Override
@DataSource(DataSourceType.QUOT)
public void deleteYlMaterialBjBatch() { public void deleteYlMaterialBjBatch() {
cYlMaterialMapper.deleteYlMaterialBjBatch(); cYlMaterialMapper.deleteYlMaterialBjBatch();
} }
@ -138,7 +139,17 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService
* @param list * @param list
*/ */
@Override @Override
@DataSource(DataSourceType.QUOT)
public void insertYlMaterialBjBatch(List<CYlMaterial> list) { public void insertYlMaterialBjBatch(List<CYlMaterial> list) {
cYlMaterialMapper.insertYlMaterialBjBatch(list); cYlMaterialMapper.insertYlMaterialBjBatch(list);
} }
/**
* 更新 c_yl_material_bjdata 表中单价字段
*/
@Override
@DataSource(DataSourceType.QUOT)
public void updateYlMaterialBjBatch() {
cYlMaterialMapper.updateYlMaterialBjBatch();
}
} }

View File

@ -97,13 +97,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<insert id="insertYlMaterialBjBatch"> <insert id="insertYlMaterialBjBatch">
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 VALUES
<foreach collection="list" index="" item="t" separator=","> <foreach collection="list" index="" item="t" separator=",">
(#{t.materialNo,jdbcType=VARCHAR}, (#{t.materialNo,jdbcType=VARCHAR},
#{t.materialName,jdbcType=VARCHAR}, #{t.materialName,jdbcType=VARCHAR},
#{t.materialPrice,jdbcType=DECIMAL}) cast(#{t.materialPrice,jdbcType=DECIMAL} as decimal(18,2)))
</foreach> </foreach>
</insert> </insert>
<update id="updateYlMaterialBjBatch">
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
</update>
</mapper> </mapper>