develop
hanrenchun 7 months ago
parent 2f8c6c77a2
commit ae6c6fe204

@ -50,9 +50,9 @@ public class JcjCjxxTask {
// String value = DeviceCache.get("32092451211328052004"); // String value = DeviceCache.get("32092451211328052004");
// System.out.println(); // System.out.println();
if (cjxxTag) { // if (cjxxTag) {
return; // return;
} // }
if (!"true".equals(ConfigParam.cjxxSwitch)) { if (!"true".equals(ConfigParam.cjxxSwitch)) {
return; return;
@ -68,14 +68,14 @@ public class JcjCjxxTask {
cjxxTag = true; cjxxTag = true;
int count = countcjxx / oncesCounts; int count = countcjxx / oncesCounts;
CountDownLatch latch = new CountDownLatch(count); // CountDownLatch latch = new CountDownLatch(count);
ExecutorService cjxxPool = Executors.newFixedThreadPool(50); // ExecutorService cjxxPool = Executors.newFixedThreadPool(50);
for (int i = 0; i <= count; i++) { for (int i = 0; i <= count; i++) {
Map cjxxMap = new HashMap(); Map cjxxMap = new HashMap();
cjxxMap.put("rowStart", i * oncesCounts); cjxxMap.put("rowStart", i * oncesCounts);
cjxxMap.put("rowEnd", (i + 1) * oncesCounts); cjxxMap.put("rowEnd", (i + 1) * oncesCounts);
cjxxPool.submit(() -> { // cjxxPool.submit(() -> {
try { try {
List<JcjCjxxViewOracle> cjxxs = cjxxOracleService.getCjxxList(cjxxMap); List<JcjCjxxViewOracle> cjxxs = cjxxOracleService.getCjxxList(cjxxMap);
for (JcjCjxxViewOracle cjxx : cjxxs) { for (JcjCjxxViewOracle cjxx : cjxxs) {
@ -111,19 +111,19 @@ public class JcjCjxxTask {
} catch (Exception e) { } catch (Exception e) {
logger.info("cjxxs:" + e.getMessage()); logger.info("cjxxs:" + e.getMessage());
} }
latch.countDown(); // latch.countDown();
}); // });
logger.info("cjxxMap数据总量:" + countcjxx + "," + "当前处理下标:" + cjxxMap.get("rowStart") + "/" + cjxxMap.get("rowEnd")); logger.info("cjxxMap数据总量:" + countcjxx + "," + "当前处理下标:" + cjxxMap.get("rowStart") + "/" + cjxxMap.get("rowEnd"));
} }
try { // try {
// Wait for all threads to complete // // Wait for all threads to complete
latch.await(); // latch.await();
} catch (InterruptedException e) { // } catch (InterruptedException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
// 关闭线程池 // 关闭线程池
cjxxPool.shutdown(); // cjxxPool.shutdown();
} }
} catch (Exception e) { } catch (Exception e) {

@ -64,14 +64,14 @@ public class JcjJjxxTask {
JjxxTag = true; JjxxTag = true;
int count = countJjxx / oncesCounts; int count = countJjxx / oncesCounts;
CountDownLatch latch = new CountDownLatch(count); // CountDownLatch latch = new CountDownLatch(count);
ExecutorService JjxxPool = Executors.newFixedThreadPool(50); // ExecutorService JjxxPool = Executors.newFixedThreadPool(50);
for (int i = 0; i <= count; i++) { for (int i = 0; i <= count; i++) {
Map JjxxMap = new HashMap(); Map JjxxMap = new HashMap();
JjxxMap.put("rowStart", i * oncesCounts); JjxxMap.put("rowStart", i * oncesCounts);
JjxxMap.put("rowEnd", (i + 1) * oncesCounts); JjxxMap.put("rowEnd", (i + 1) * oncesCounts);
JjxxPool.submit(() -> { // JjxxPool.submit(() -> {
try { try {
List<JcjJjxxViewOracle> Jjxxs = jcjJjxxViewOracleService.getJjxxList(JjxxMap); List<JcjJjxxViewOracle> Jjxxs = jcjJjxxViewOracleService.getJjxxList(JjxxMap);
for (JcjJjxxViewOracle Jjxx : Jjxxs) { for (JcjJjxxViewOracle Jjxx : Jjxxs) {
@ -90,19 +90,19 @@ public class JcjJjxxTask {
} catch (Exception e) { } catch (Exception e) {
logger.info("Jjxxs:" + StringKit.getTrace(e)); logger.info("Jjxxs:" + StringKit.getTrace(e));
} }
latch.countDown(); // latch.countDown();
}); // });
logger.info("JjxxMap数据总量:" + countJjxx + "," + "当前处理下标:" + JjxxMap.get("rowStart") + "/" + JjxxMap.get("rowEnd")); logger.info("JjxxMap数据总量:" + countJjxx + "," + "当前处理下标:" + JjxxMap.get("rowStart") + "/" + JjxxMap.get("rowEnd"));
} }
try { // try {
// Wait for all threads to complete // // Wait for all threads to complete
latch.await(); // latch.await();
} catch (InterruptedException e) { // } catch (InterruptedException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
// 关闭线程池 // // 关闭线程池
JjxxPool.shutdown(); // JjxxPool.shutdown();
} }
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save