yaozhixue il y a 1 an
Parent
commit
c21265cf02

+ 27 - 18
src/main/java/com/zfire/jiasm/syncdata/service/impl/ProvinceCityAreaTownServiceImpl.java

@@ -84,16 +84,24 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
         for (int i = 0; i < jsonArray.size(); i++) {
             JSONObject aData = jsonArray.getJSONObject(i);
             ItfTblCityDownload item = JSON.toJavaObject(aData,ItfTblCityDownload.class);
-
-
-            log.info("市 item:{}", JSONObject.toJSONString(item));
-
             // 新增或修改
             extractedCityAddOrUpdate(addRec, updateRec, addRecn, updateRecn, synTaskNo, oldRecCiid, oldRecMap, item);
             // 数据同步落到同步信息表
             extractedLocalCityAddOrUpdata(addRecn, updateRecn);
         }
 
+        if (addRecn.size()>0){
+            itfTblCityDownloadService.saveBatch(addRecn);
+            log.info("市信息同步新增插入了{}条数据", addRecn.size());
+            addRecn.clear();
+        }
+        // 更新
+        if (updateRecn.size()>0){
+            itfTblCityDownloadService.updateBatchById(updateRecn);
+            log.info("市信息同步更新修改了{}条数据", updateRecn.size());
+            updateRecn.clear();
+        }
+
         // 市数据同步到本地表
         extractedLoadlCityAddOrUpdate(addRec, updateRec);
         addRec.clear();
@@ -141,13 +149,13 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
         // 新增的插入到表
         if (addStreet.size()>0){
-            streetService.saveBatch(addStreet);
+            streetService.saveOrUpdateBatch(addStreet);
             log.info("本地乡镇信息表新增插入了{}条数据",addStreet.size());
             addStreet.clear();
         }
         // 更新
         if (updateStreet.size()>0){
-            streetService.updateBatchById(updateStreet);
+            streetService.saveOrUpdateBatch(updateStreet);
             log.info("本地乡镇信息表更新修改了{}条数据", updateStreet.size());
             updateStreet.clear();
         }
@@ -202,7 +210,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                 // 新增的插入到表
                 if (addStreet.size()>=500){
-                    streetService.saveBatch(addStreet);
+                    streetService.saveOrUpdateBatch(addStreet);
                     log.info("本地乡镇信息表新增插入了{}条数据",addStreet.size());
                     addStreet.clear();
                 }
@@ -258,7 +266,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                 // 更新
                 if (updateStreet.size()>=500){
-                    streetService.updateBatchById(updateStreet);
+                    streetService.saveOrUpdateBatch(updateStreet);
                     log.info("本地乡镇信息表更新修改了{}条数据", updateStreet.size());
                     updateStreet.clear();
                 }
@@ -422,13 +430,13 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
         // 新增的插入到表
         if (addProvince.size()>0){
-            provinceService.saveBatch(addProvince);
+            provinceService.saveOrUpdateBatch(addProvince);
             log.info("本地省份信息表新增插入了{}条数据",addProvince.size());
             addProvince.clear();
         }
         // 更新
         if (updateProvince.size()>0){
-            provinceService.updateBatchById(updateProvince);
+            provinceService.saveOrUpdateBatch(updateProvince);
             log.info("本地省份信息表更新修改了{}条数据", updateProvince.size());
             updateProvince.clear();
         }
@@ -499,6 +507,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
         List<City> addCity = new ArrayList<>();
         List<City> updateCity = new ArrayList<>();
 
+
         // 获取新增的
         if (addRec.size()>0){
             for (ItfTblCityDownload item : addRec){
@@ -521,7 +530,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                 // 新增的插入到表
                 if (addCity.size()>=500){
-                    cityService.saveBatch(addCity);
+                    cityService.saveOrUpdateBatch(addCity);
                     log.info("本地市信息表新增插入了{}条数据",addCity.size());
                     addCity.clear();
                 }
@@ -549,7 +558,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                 // 更新
                 if (updateCity.size()>=500){
-                    cityService.updateBatchById(updateCity);
+                    cityService.saveOrUpdateBatch(updateCity);
                     log.info("本地市信息表更新修改了{}条数据", updateCity.size());
                     updateCity.clear();
                 }
@@ -558,13 +567,13 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
         // 新增的插入到表
         if (addCity.size()>0){
-            cityService.saveBatch(addCity);
+            cityService.saveOrUpdateBatch(addCity);
             log.info("本地市信息表新增插入了{}条数据",addCity.size());
             addCity.clear();
         }
         // 更新
         if (updateCity.size()>0){
-            cityService.updateBatchById(updateCity);
+            cityService.saveOrUpdateBatch(updateCity);
             log.info("本地市信息表更新修改了{}条数据", updateCity.size());
             updateCity.clear();
         }
@@ -734,13 +743,13 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
         // 新增的插入到表
         if (addArea.size()>0){
-            areaService.saveBatch(addArea);
+            areaService.saveOrUpdateBatch(addArea);
             log.info("本地区信息表新增插入了{}条数据",addArea.size());
             addArea.clear();
         }
         // 更新
         if (updateArea.size()>0){
-            areaService.updateBatchById(updateArea);
+            areaService.saveOrUpdateBatch(updateArea);
             log.info("本地区信息表更新修改了{}条数据", updateArea.size());
             updateArea.clear();
         }
@@ -785,7 +794,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                 // 更新
                 if (updateArea.size()>=500){
-                    areaService.updateBatchById(updateArea);
+                    areaService.saveOrUpdateBatch(updateArea);
                     updateArea.clear();
                     log.info("本地区信息表更新修改了{}条数据", updateArea.size());
                 }
@@ -830,7 +839,7 @@ public class ProvinceCityAreaTownServiceImpl implements ProvinceCityAreaTownServ
 
                     // 新增的插入到表
                     if (addArea.size()>=500){
-                        areaService.saveBatch(addArea);
+                        areaService.saveOrUpdateBatch(addArea);
                         addArea.clear();
                         log.info("本地区信息表新增插入了{}条数据",addArea.size());
                     }