sap修改

highway
shaoyong 1 year ago
parent 55df9b2ec8
commit 97e5b56b03

@ -192,7 +192,7 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++供应商主数据开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
sapSupplierQuery.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
Date maxTime = sapBomMapper.getMaxTime();
Date maxTime = sapBomMapper.getSupplierMaxTime();
if(maxTime != null){
sapSupplierQuery.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
@ -227,7 +227,7 @@ public class SapController extends BaseController {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++客户主数据开始++++++++++");
DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key
sapCustom.setBukrs(dateSource.get("poolName").replace("ds_",""));//工厂
Date maxTime = sapBomMapper.getMaxTime();
Date maxTime = sapBomMapper.getCustomMaxTime();
if(maxTime != null){
sapCustom.setErdat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}

@ -25,6 +25,12 @@ public interface SapBomMapper {
public Date getMaxTime();
public List<String> getExsitCodes(@Param("list") List<String> codes);
public Date getSupplierMaxTime();
public List<String> getSupplierExsitCodes(@Param("list") List<String> codes);
public Date getCustomMaxTime();
public List<String> getCustomExsitCodes(@Param("list") List<String> codes);
int updateFactoryBatchs(@Param("list")List<SapWorkCenter> updates);

@ -301,7 +301,7 @@ public class SapWorkCenterServiceImpl implements SapWorkCenterService {
//sap返回的供应商编码
List<String> codes = dtos.stream().map(SapSupplier::getLifnr).collect(Collectors.toList());
//sap返回的供应商编码-本地已存在
List<String> exsitCodes = sapBomMapper.getExsitCodes(codes);
List<String> exsitCodes = sapBomMapper.getSupplierExsitCodes(codes);
//sap返回的供应商编码-本地不存在// 差集 (list2 - list1)
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());
@ -339,7 +339,7 @@ public class SapWorkCenterServiceImpl implements SapWorkCenterService {
//sap返回的客户编码
List<String> codes = dtos.stream().map(SapCustom::getKunnr).collect(Collectors.toList());
//sap返回的客户编码-本地已存在
List<String> exsitCodes = sapBomMapper.getExsitCodes(codes);
List<String> exsitCodes = sapBomMapper.getCustomExsitCodes(codes);
//sap返回的客户编码-本地不存在// 差集 (list2 - list1)
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());

@ -258,52 +258,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="getSupplierMaxTime" resultType="java.util.Date">
select max(create_time) from base_supplier where create_by = 'job'
</select>
<select id="getSupplierExsitCodes" resultType="java.lang.String">
select factory_code from base_supplier where factory_code in
<foreach collection="list" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</select>
<select id="getCustomMaxTime" resultType="java.util.Date">
select max(create_time) from sys_customer where create_by = 'job'
</select>
<select id="getCustomExsitCodes" resultType="java.lang.String">
select factory_code from sys_customer where factory_code in
<foreach collection="list" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</select>
<!--批量更新供应商建模表-->
<update id="updateSupplierBatchs">
<foreach collection="list" item="item" separator=";">
update base_supplier
set zh_desc = #{item.name1}
set
zh_desc = #{item.name1},
contact_phone = #{item.telf1},
address = #{item.stars},
factory_code = #{item.bukrs}
where
supplier_code = #{item.bukrs}
supplier_code = #{item.lifnr}
</foreach>
</update>
<!--批量添加供应商建模表-->
<insert id="addSupplierBatchs">
insert into base_supplier
(supplier_code,zh_desc,contact_phone,address,
(supplier_code,zh_desc,contact_phone,address,factory_code,
create_by,
create_time,
update_time)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(#{item.bukrs},#{item.name1},#{item.telf1},#{item.stras},
(#{item.lifnr},#{item.name1},#{item.telf1},#{item.stars},#{item.bukrs}
'job',
#{item.erdat},
#{item.erdat})
</foreach>
</insert>
<!--批量更新供应商建模表-->
<!--批量更新客户建模表-->
<update id="updateCustomBatchs">
<foreach collection="list" item="item" separator=";">
update sys_customer
set client_name = #{item.name1}
set
client_name = #{item.name1},
contact1_tel = #{item.telf1},
address = #{item.stars},
factory_code = #{item.bukrs}
where
client_code = #{item.bukrs}
client_code = #{item.kunnr}
</foreach>
</update>
<!--批量添加供应商建模表-->
<!--批量添加客户建模表-->
<insert id="addCustomBatchs">
insert into sys_customer
(client_code,client_name,contact1_tel,address,
(client_code,client_name,contact1_tel,address,factory_code,
create_by,
create_time,
update_time,factory_code)
update_time)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(#{item.lifnr},#{item.name1},#{item.telf1},#{item.stars}
(#{item.kunnr},#{item.name1},#{item.telf1},#{item.stars},#{item.bukrs},
'job',
#{item.erdat},
#{item.erdat},#{item.bukrs})
#{item.erdat})
</foreach>
</insert>
</mapper>

Loading…
Cancel
Save