Commit ec09224f authored by lisong's avatar lisong

同步接口修改

parent c6d81d91
......@@ -29,8 +29,10 @@ public interface CylCylinderFillingCheckMapper extends BaseMapper<CylinderFillin
List<CylinderInfo> getCylinderInfoList();
void updateBatch(@Param("sequenceNbrS") List<Long> sequenceNbrS);
List<CylinderFilling> queryUnSyncFilling();
boolean updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes);
boolean updataSyncFilling(@Param("ids") List<Long> appIds);
boolean saveAndBatchInsert(@Param("list") List<CylinderFilling> list);
......
......@@ -71,24 +71,29 @@
<update id="updataSyncFilling">
update tm_cylinder_filling set sync_state = 3
<where>
<if test="appIds != null and appIds.size() > 0">
app_id in
<foreach collection="appIds" item="appId" index="index" open="(" close=")" separator=",">
#{appId}
</foreach>
</if>
<if test="fillingBeforeIds != null and fillingBeforeIds.size() > 0">
and filling_before_id in
<foreach collection="fillingBeforeIds" item="fillingBeforeId" index="index" open="(" close=")" separator=",">
#{fillingBeforeId}
</foreach>
</if>
<if test="sequenceCodes != null and sequenceCodes.size() > 0">
and sequence_code in
<foreach collection="sequenceCodes" item="sequenceCode" index="index" open="(" close=")" separator=",">
#{sequenceCode}
</foreach>
</if>
<!-- <if test="appIds != null and appIds.size() > 0">-->
<!-- app_id in-->
<!-- <foreach collection="appIds" item="appId" index="index" open="(" close=")" separator=",">-->
<!-- #{appId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="fillingBeforeIds != null and fillingBeforeIds.size() > 0">-->
<!-- and filling_before_id in-->
<!-- <foreach collection="fillingBeforeIds" item="fillingBeforeId" index="index" open="(" close=")" separator=",">-->
<!-- #{fillingBeforeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="sequenceCodes != null and sequenceCodes.size() > 0">-->
<!-- and sequence_code in-->
<!-- <foreach collection="sequenceCodes" item="sequenceCode" index="index" open="(" close=")" separator=",">-->
<!-- #{sequenceCode}-->
<!-- </foreach>-->
<!-- </if>-->
sequence_nbr in
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
</update>
......
......@@ -127,10 +127,18 @@ public class CylSyncServiceImpl {
public Object fillingSync() {
try {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<CylinderFilling> unSyncFilling = sourceFillingCheckServiceImpl.queryUnSyncFilling();
stopWatch.stop();
System.out.println("查询时间:"+stopWatch.getTotalTimeSeconds());
while (!unSyncFilling.isEmpty()) {
fillingDataProcessing(unSyncFilling);
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
unSyncFilling = sourceFillingCheckServiceImpl.queryUnSyncFilling();
stopWatch1.stop();
System.out.println("查询2时间:"+stopWatch.getTotalTimeSeconds());
}
} catch (Exception ex) {
return "failed";
......@@ -140,13 +148,14 @@ public class CylSyncServiceImpl {
@Transactional(rollbackFor = {Exception.class})
public void fillingDataProcessing(List<CylinderFilling> data) {
List<String> appIds = new ArrayList<>();
List<String> fillingBeforeIds = new ArrayList<>();
List<String> sequenceCodes = new ArrayList<>();
// List<String> appIds = new ArrayList<>();
// List<String> fillingBeforeIds = new ArrayList<>();
// List<String> sequenceCodes = new ArrayList<>();
List<Long> ids = data.stream().map(CylinderFilling::getSequenceNbr).collect(Collectors.toList());
data.forEach(e -> {
appIds.add(e.getAppId());
fillingBeforeIds.add(e.getFillingBeforeId());
sequenceCodes.add(e.getSequenceCode());
// appIds.add(e.getAppId());
// fillingBeforeIds.add(e.getFillingBeforeId());
// sequenceCodes.add(e.getSequenceCode());
String isValid = e.getIsValid();
if (!ObjectUtil.isEmpty(isValid) && ("1".equals(isValid) || "0".equals(isValid))) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(Integer.valueOf(isValid), "isValid");
......@@ -204,8 +213,17 @@ public class CylSyncServiceImpl {
}
});
StopWatch stopWatch = new StopWatch();
stopWatch.start();
cylCylinderFillingCheckMapper.saveAndBatchInsert(data);
sourceFillingCheckServiceImpl.updataSyncFilling(appIds, fillingBeforeIds, sequenceCodes);
stopWatch.stop();
System.out.println("插入时间:"+ stopWatch.getTotalTimeSeconds());
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
sourceFillingCheckServiceImpl.updataSyncFilling(ids);
stopWatch1.stop();
System.out.println("更新时间:"+ stopWatch1.getTotalTimeSeconds());
}
......
......@@ -54,8 +54,8 @@ public class CylinderSyncServiceImpl {
return fillingCheckMapper.queryUnSyncFilling();
}
public boolean updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes){
return fillingCheckMapper.updataSyncFilling(appIds, fillingBeforeIds, sequenceCodes);
public boolean updataSyncFilling(List<Long> ids){
return fillingCheckMapper.updataSyncFilling(ids);
}
public Long fillingRecordSync(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment