记得上下班打卡 | git大法好,push需谨慎

Commit 050b56ef authored by jiangxiulong's avatar jiangxiulong

Merge branch 'dev' into test

parents acc9f92b 15f62034
...@@ -9,6 +9,9 @@ package com.liquidnet.service.kylin.constant; ...@@ -9,6 +9,9 @@ package com.liquidnet.service.kylin.constant;
* @since 2021-05-25 6:38 下午 * @since 2021-05-25 6:38 下午
*/ */
public class KylinTableStatusConst { public class KylinTableStatusConst {
/**
* 退款
*/
// 批量退款 1处理完成 11 处理中 // 批量退款 1处理完成 11 处理中
public static final Integer STATUS_APPLY = 1; // 1申请退款 public static final Integer STATUS_APPLY = 1; // 1申请退款
public static final Integer STATUS_APPLY11 = 11; public static final Integer STATUS_APPLY11 = 11;
...@@ -72,4 +75,10 @@ public class KylinTableStatusConst { ...@@ -72,4 +75,10 @@ public class KylinTableStatusConst {
// 出票状态 // 出票状态
public static final Integer ENTITIES_STATUS0 = 0; // 未出票 public static final Integer ENTITIES_STATUS0 = 0; // 未出票
public static final Integer ENTITIES_STATUS1 = 1; // 已出票 public static final Integer ENTITIES_STATUS1 = 1; // 已出票
/**
* 快递
*/
public static final Integer ORDER_EXPRESS_STATUS1 = 1; // 申请
public static final Integer ORDER_EXPRESS_STATUS2 = 2; // 取消
} }
...@@ -95,4 +95,42 @@ public class PerformancesExpressController extends BaseController { ...@@ -95,4 +95,42 @@ public class PerformancesExpressController extends BaseController {
} }
} }
/**
* 取消
*/
@RequiresPermissions("kylin:performancesExpress:cancelOrder")
@PostMapping("/cancelOrder")
@ResponseBody
public AjaxResult cancelOrder(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
ResponseDto res = performancesExpressServiceImpl.cancelOrder(performanceExpressSearchAdminParam);
try {
if (res.isSuccess()) {
return success();
} else {
return error(res.getMessage());
}
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 结果主动查询
*/
@RequiresPermissions("kylin:performancesExpress:getResult")
@PostMapping("/getResult")
@ResponseBody
public AjaxResult getResult(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
ResponseDto res = performancesExpressServiceImpl.getResult(performanceExpressSearchAdminParam);
try {
if (res.isSuccess()) {
return success();
} else {
return error(res.getMessage());
}
} catch (Exception e) {
return error(e.getMessage());
}
}
} }
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<script th:inline="javascript"> <script th:inline="javascript">
var placeOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:placeOrder')}]]; var placeOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:placeOrder')}]];
var cancelOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:cancelOrder')}]];
var getResultFlag = [[${@permission.hasPermi('kylin:performancesExpress:getResult')}]];
var prefix = ctx + "kylin/performancesExpress"; var prefix = ctx + "kylin/performancesExpress";
...@@ -79,6 +81,8 @@ ...@@ -79,6 +81,8 @@
url: prefix + "/performanceOrderList", url: prefix + "/performanceOrderList",
modalName: "演出订单", modalName: "演出订单",
placeOrderUrl: prefix + "/placeOrder", placeOrderUrl: prefix + "/placeOrder",
cancelOrderUrl: prefix + "/cancelOrder",
getResultUrl: prefix + "/getResult",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
...@@ -135,7 +139,9 @@ ...@@ -135,7 +139,9 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + placeOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定下单吗?\', table.options.placeOrderUrl)"></i>下单</a> '); actions.push('<a class="btn btn-success btn-xs ' + placeOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定下单吗?\', table.options.placeOrderUrl)"></i>下单</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + cancelOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定取消快递单吗?\', table.options.cancelOrderUrl)"></i>取消</a> ');
actions.push('<a class="btn btn-default btn-xs ' + getResultFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定获取快递信息吗?\', table.options.getResultUrl)"></i>主动获取下单信息</a> ');
return actions.join(''); return actions.join('');
} }
}] }]
......
...@@ -167,12 +167,14 @@ public class MongoVoUtils { ...@@ -167,12 +167,14 @@ public class MongoVoUtils {
KylinOrderListVo voItem = new KylinOrderListVo(); KylinOrderListVo voItem = new KylinOrderListVo();
KylinOrderTicketVo data; KylinOrderTicketVo data;
if (dataSingle == null) { if (dataSingle == null) {
data = (KylinOrderTicketVo) redisUtil.get(KylinRedisConst.ORDER + orderId); data = (KylinOrderTicketVo) dataUtils.getOrderTicketVo(orderId);
// data = (KylinOrderTicketVo) redisUtil.get(KylinRedisConst.ORDER + orderId);
} else { } else {
data = dataSingle; data = dataSingle;
} }
BeanUtils.copyProperties(data, voItem); BeanUtils.copyProperties(data, voItem);
List<KylinOrderListVo> redisData = (List<KylinOrderListVo>) redisUtil.get(KylinRedisConst.ORDER_LIST + userId); List<KylinOrderListVo> redisData = (List<KylinOrderListVo>) dataUtils.getOrderList(userId);
// List<KylinOrderListVo> redisData = (List<KylinOrderListVo>) redisUtil.get(KylinRedisConst.ORDER_LIST + userId);
if (type == 1) { if (type == 1) {
redisVo.add(voItem); redisVo.add(voItem);
if (redisData.size() > 0) { if (redisData.size() > 0) {
......
...@@ -118,21 +118,14 @@ spring: ...@@ -118,21 +118,14 @@ spring:
url: jdbc:mysql://${liquidnet.mysql.urlHostAndPort}/${liquidnet.mysql.database-name}?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&useSSL=false url: jdbc:mysql://${liquidnet.mysql.urlHostAndPort}/${liquidnet.mysql.database-name}?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&useSSL=false
username: ${liquidnet.mysql.username} username: ${liquidnet.mysql.username}
password: ${liquidnet.mysql.password} password: ${liquidnet.mysql.password}
# type: org.apache.tomcat.jdbc.pool.DataSource # type: org.apache.tomcat.jdbc.pool.DataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
filters: stat hikari:
maxActive: 200 maximum-pool-size: 500
initialSize: 1 # 迁移数据暂设10分钟
maxWait: 60000 connection-timeout: 600000
minIdle: 1 minimum-idle: 10
timeBetweenEvictionRunsMillis: 60000 connection-test-query: SELECT 1
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
# ----------------------------------------------------------- # -----------------------------------------------------------
# ----------------------------------------------------------- # -----------------------------------------------------------
......
...@@ -19,6 +19,7 @@ public class PerformanceExpressPerformanceOrderListAdminDao { ...@@ -19,6 +19,7 @@ public class PerformanceExpressPerformanceOrderListAdminDao {
String expressContacts; String expressContacts;
String expressAddress; String expressAddress;
String expressPhone; String expressPhone;
String expressStatus;
Integer expressType; Integer expressType;
......
...@@ -26,10 +26,12 @@ public class KylinOrderExpress implements Serializable { ...@@ -26,10 +26,12 @@ public class KylinOrderExpress implements Serializable {
private String orderExpressId; private String orderExpressId;
private String orderTicketsId; private String orderTicketsId;
private String OrderExpressCode;
private String mailno; private String mailno;
private Integer expressType; private Integer expressType;
private Integer filterResult; private String filterResult;
private String remark; private String remark;
private Integer expressStatus;
private String origincode; private String origincode;
private String destcode; private String destcode;
private String printIcon; private String printIcon;
......
...@@ -42,7 +42,7 @@ create table adam_user ...@@ -42,7 +42,7 @@ create table adam_user
( (
mid bigint unsigned auto_increment primary key, mid bigint unsigned auto_increment primary key,
uid varchar(64) not null, uid varchar(64) not null,
mobile varchar(30) not null, mobile varchar(30),
passwd varchar(64), passwd varchar(64),
pay_code varchar(64), pay_code varchar(64),
state tinyint default 0 comment '1-NORMAL,2-INVALID', state tinyint default 0 comment '1-NORMAL,2-INVALID',
......
...@@ -67,6 +67,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -67,6 +67,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmUserInformationProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmUserInformationProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -95,6 +96,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -95,6 +96,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmThirdPartsProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmThirdPartsProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -123,6 +125,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -123,6 +125,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmRealNameProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmRealNameProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -151,6 +154,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -151,6 +154,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmCollectionProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmCollectionProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -179,6 +183,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -179,6 +183,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmEntersProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmEntersProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -207,6 +212,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -207,6 +212,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmAddressesProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmAddressesProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
...@@ -235,6 +241,7 @@ public class AdamDMAdminController extends AdamBaseController { ...@@ -235,6 +241,7 @@ public class AdamDMAdminController extends AdamBaseController {
log.info("==================" + k); log.info("==================" + k);
dmUserMemberProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : ""); dmUserMemberProcessor.dataProcessing(k, dG, null, null, k == 0 ? "1" : "");
}); });
try { Thread.sleep(100L); } catch (InterruptedException ignored) {}
} }
exec.shutdown(); exec.shutdown();
} else { } else {
......
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -47,15 +47,20 @@ public class DMAddressesProcessor extends DataMigrationProcessorService { ...@@ -47,15 +47,20 @@ public class DMAddressesProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_MALL, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_MALL, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -68,7 +73,6 @@ public class DMAddressesProcessor extends DataMigrationProcessorService { ...@@ -68,7 +73,6 @@ public class DMAddressesProcessor extends DataMigrationProcessorService {
List<AdamAddressesVo> vos = new ArrayList<>(); List<AdamAddressesVo> vos = new ArrayList<>();
while (row.next()) { while (row.next()) {
String uid = row.getString(2); String uid = row.getString(2);
if (!reUidList.contains(uid)) { if (!reUidList.contains(uid)) {
AdamAddresses addresses = new AdamAddresses(); AdamAddresses addresses = new AdamAddresses();
addresses.setAddressesId(row.getString(1)); addresses.setAddressesId(row.getString(1));
...@@ -88,20 +92,37 @@ public class DMAddressesProcessor extends DataMigrationProcessorService { ...@@ -88,20 +92,37 @@ public class DMAddressesProcessor extends DataMigrationProcessorService {
addressesList.add(addresses); addressesList.add(addresses);
vos.add(vo); vos.add(vo);
} }
} if (addressesList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, addressesList.size());
if (!CollectionUtils.isEmpty(addressesList)) {
tl += addressesList.size(); tl += addressesList.size();
mongoTemplate.insert(vos, AdamAddressesVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamAddressesVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamAddressesService.saveBatch(addressesList)); log.info("DM.execute.limit.result:{}", adamAddressesService.saveBatch(addressesList));
vos.clear();
addressesList.clear();
} }
}
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -35,7 +35,7 @@ public class DMCollectionProcessor extends DataMigrationProcessorService { ...@@ -35,7 +35,7 @@ public class DMCollectionProcessor extends DataMigrationProcessorService {
log.info("DM.flush.AdamCollectVo:{}", mongoTemplate.remove(Query.query(Criteria.where("_id").exists(true)), AdamCollectVo.class.getSimpleName()).getDeletedCount()); log.info("DM.flush.AdamCollectVo:{}", mongoTemplate.remove(Query.query(Criteria.where("_id").exists(true)), AdamCollectVo.class.getSimpleName()).getDeletedCount());
} }
String sqlCount = "select count(1) from user_collections where type='TICKET' and status=1 and content_id>=5722 and created_at"+(StringUtils.isBlank(incrDt) ? "<" : ">=")+"curdate()"; String sqlCount = "select count(1) from user_collections where type='TICKET' and status=1 and content_id>=5722 and created_at" + (StringUtils.isBlank(incrDt) ? "<" : ">=") + "curdate()";
if (null != dg) { if (null != dg) {
sqlCount = sqlCount + " and id%" + dG + "=" + dg; sqlCount = sqlCount + " and id%" + dG + "=" + dg;
} }
...@@ -48,15 +48,20 @@ public class DMCollectionProcessor extends DataMigrationProcessorService { ...@@ -48,15 +48,20 @@ public class DMCollectionProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -81,20 +86,37 @@ public class DMCollectionProcessor extends DataMigrationProcessorService { ...@@ -81,20 +86,37 @@ public class DMCollectionProcessor extends DataMigrationProcessorService {
collectionList.add(collection); collectionList.add(collection);
vos.add(AdamCollectVo.getNew().copy(collection)); vos.add(AdamCollectVo.getNew().copy(collection));
} }
} if (collectionList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, collectionList.size());
if (!CollectionUtils.isEmpty(collectionList)) {
tl += collectionList.size(); tl += collectionList.size();
mongoTemplate.insert(vos, AdamCollectVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamCollectVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamCollectionService.saveBatch(collectionList)); log.info("DM.execute.limit.result:{}", adamCollectionService.saveBatch(collectionList));
vos.clear();
collectionList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -48,15 +48,20 @@ public class DMEntersProcessor extends DataMigrationProcessorService { ...@@ -48,15 +48,20 @@ public class DMEntersProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_MALL, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_MALL, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -69,7 +74,6 @@ public class DMEntersProcessor extends DataMigrationProcessorService { ...@@ -69,7 +74,6 @@ public class DMEntersProcessor extends DataMigrationProcessorService {
List<AdamEntersVo> vos = new ArrayList<>(); List<AdamEntersVo> vos = new ArrayList<>();
while (row.next()) { while (row.next()) {
String uid = row.getString(2); String uid = row.getString(2);
if (!reUidList.contains(uid)) { if (!reUidList.contains(uid)) {
AdamEnters enters = new AdamEnters(); AdamEnters enters = new AdamEnters();
enters.setEntersId(row.getString(1)); enters.setEntersId(row.getString(1));
...@@ -87,20 +91,37 @@ public class DMEntersProcessor extends DataMigrationProcessorService { ...@@ -87,20 +91,37 @@ public class DMEntersProcessor extends DataMigrationProcessorService {
entersList.add(enters); entersList.add(enters);
vos.add(vo); vos.add(vo);
} }
} if (entersList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, entersList.size());
if (!CollectionUtils.isEmpty(entersList)) {
tl += entersList.size(); tl += entersList.size();
mongoTemplate.insert(vos, AdamEntersVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamEntersVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamEntersService.saveBatch(entersList)); log.info("DM.execute.limit.result:{}", adamEntersService.saveBatch(entersList));
vos.clear();
entersList.clear();
} }
}
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -73,15 +73,20 @@ public class DMMemberOrderProcessor extends DataMigrationProcessorService { ...@@ -73,15 +73,20 @@ public class DMMemberOrderProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -124,20 +129,37 @@ public class DMMemberOrderProcessor extends DataMigrationProcessorService { ...@@ -124,20 +129,37 @@ public class DMMemberOrderProcessor extends DataMigrationProcessorService {
memberOrderList.add(memberOrder); memberOrderList.add(memberOrder);
vos.add(vo); vos.add(vo);
} }
} if (memberOrderList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, memberOrderList.size());
if (!CollectionUtils.isEmpty(memberOrderList)) {
tl += memberOrderList.size(); tl += memberOrderList.size();
mongoTemplate.insert(vos, AdamMemberOrderVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamMemberOrderVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamMemberOrderService.saveBatch(memberOrderList)); log.info("DM.execute.limit.result:{}", adamMemberOrderService.saveBatch(memberOrderList));
vos.clear();
memberOrderList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -48,15 +48,20 @@ public class DMRealNameProcessor extends DataMigrationProcessorService { ...@@ -48,15 +48,20 @@ public class DMRealNameProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -90,20 +95,37 @@ public class DMRealNameProcessor extends DataMigrationProcessorService { ...@@ -90,20 +95,37 @@ public class DMRealNameProcessor extends DataMigrationProcessorService {
realNameList.add(realName); realNameList.add(realName);
vos.add(vo); vos.add(vo);
} }
} if (realNameList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, realNameList.size());
if (!CollectionUtils.isEmpty(realNameList)) {
tl += realNameList.size(); tl += realNameList.size();
mongoTemplate.insert(vos, AdamRealInfoVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamRealInfoVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamRealNameService.saveBatch(realNameList)); log.info("DM.execute.limit.result:{}", adamRealNameService.saveBatch(realNameList));
vos.clear();
realNameList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -36,7 +36,7 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService { ...@@ -36,7 +36,7 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService {
} }
String sqlCount = "select count(1) from (\n" + String sqlCount = "select count(1) from (\n" +
" select row_number() over (partition by uid,type order by created_at desc) rn,id,uid,open_id,avatar,nickname,type,created_at,updated_at from user_third_parts where `status`=1 and delete_tag in (0,1) and open_id<>'' and uid>0 and created_at"+(StringUtils.isBlank(incrDt) ? "<" : ">=")+"curdate()\n" + " select row_number() over (partition by uid,type order by created_at desc) rn,id,uid,open_id,avatar,nickname,type,created_at,updated_at from user_third_parts where `status`=1 and delete_tag in (0,1) and open_id<>'' and uid>0 and created_at" + (StringUtils.isBlank(incrDt) ? "<" : ">=") + "curdate()\n" +
" ) t where t.rn=1"; " ) t where t.rn=1";
if (null != dg) { if (null != dg) {
sqlCount = sqlCount + " and id%" + dG + "=" + dg; sqlCount = sqlCount + " and id%" + dG + "=" + dg;
...@@ -50,15 +50,20 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService { ...@@ -50,15 +50,20 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -95,20 +100,37 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService { ...@@ -95,20 +100,37 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService {
thirdPartyList.add(thirdParty); thirdPartyList.add(thirdParty);
vos.add(vo); vos.add(vo);
} }
} if (thirdPartyList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, thirdPartyList.size());
if (!CollectionUtils.isEmpty(thirdPartyList)) {
tl += thirdPartyList.size(); tl += thirdPartyList.size();
mongoTemplate.insert(vos, AdamThirdPartInfoVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamThirdPartInfoVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamThirdPartyService.saveBatch(thirdPartyList)); log.info("DM.execute.limit.result:{}", adamThirdPartyService.saveBatch(thirdPartyList));
vos.clear();
thirdPartyList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -18,11 +18,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,11 +18,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -68,15 +68,20 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService { ...@@ -68,15 +68,20 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService {
} }
sql += " order by uid limit ?,?"; sql += " order by uid limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -132,21 +137,38 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService { ...@@ -132,21 +137,38 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService {
userInfoList.add(userInfo); userInfoList.add(userInfo);
vos.add(vo); vos.add(vo);
} }
} if (userList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, userList.size());
if (!CollectionUtils.isEmpty(userList)) {
tl += userList.size(); tl += userList.size();
mongoTemplate.insert(vos, AdamUserInfoVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamUserInfoVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamUserService.saveBatch(userList)); log.info("DM.execute.result:{} - {}", adamUserService.saveBatch(userList), adamUserInfoService.saveBatch(userInfoList));
log.info("DM.execute.limit.result:{}", adamUserInfoService.saveBatch(userInfoList)); vos.clear();
userList.clear();
userInfoList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,11 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -48,15 +48,20 @@ public class DMUserMemberProcessor extends DataMigrationProcessorService { ...@@ -48,15 +48,20 @@ public class DMUserMemberProcessor extends DataMigrationProcessorService {
} }
sql += " order by id limit ?,?"; sql += " order by id limit ?,?";
Connection connection = null;
PreparedStatement statement = null;
ResultSetImpl row = null;
try {
Class.forName(DB_DRIVER); Class.forName(DB_DRIVER);
Connection connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD); connection = DriverManager.getConnection(DB_URL + DB_NAME_PASSPORT, DB_USER, DB_PWD);
statement = connection.prepareStatement(sqlCount);
PreparedStatement statement = connection.prepareStatement(sqlCount); row = (ResultSetImpl) statement.executeQuery();
ResultSetImpl row = (ResultSetImpl) statement.executeQuery();
row.first(); row.first();
int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct; int ct = row.getInt(1), pSize = 1000, num = 0, tl = 0, pl = ct;
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> start.sql:{}", pl, num, pSize, tl, sql);
row.close();
statement.close();
while (ct > 0) { while (ct > 0) {
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
int ls = pSize * num; int ls = pSize * num;
...@@ -91,20 +96,37 @@ public class DMUserMemberProcessor extends DataMigrationProcessorService { ...@@ -91,20 +96,37 @@ public class DMUserMemberProcessor extends DataMigrationProcessorService {
userMemberList.add(userMember); userMemberList.add(userMember);
vos.add(vo); vos.add(vo);
} }
} if (userMemberList.size() == 500) {
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, userMemberList.size());
if (!CollectionUtils.isEmpty(userMemberList)) {
tl += userMemberList.size(); tl += userMemberList.size();
mongoTemplate.insert(vos, AdamUserMemberVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamUserMemberVo.class.getSimpleName());
log.info("DM.execute.limit.result:{}", adamUserMemberService.saveBatch(userMemberList)); log.info("DM.execute.limit.result:{}", adamUserMemberService.saveBatch(userMemberList));
vos.clear();
userMemberList.clear();
}
} }
row.close();
statement.close();
num++; num++;
ct -= pSize; ct -= pSize;
log.info("DM.execute.limit {},{} - handle.counts:{}", ls, pSize, tl);
} }
log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl); log.info("DM.execute.counts:{}/{},{} ~ {} ----------------------------> end", pl, num, pSize, tl);
row.close(); } catch (Exception e) {
statement.close(); log.error("ex:getConnection,dG/dg:{}/{},msg:{}", dG, dg, e.getMessage());
connection.close(); }
try {
if (null != row) row.close();
} catch (SQLException ignored) {
}
try {
if (null != statement) statement.close();
} catch (SQLException ignored) {
}
try {
if (null != connection) connection.close();
} catch (SQLException ignored) {
}
} }
} }
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