|
|
@@ -58,6 +58,11 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
public void execute() { |
|
|
|
CountThreadExecutor countThreadExecutor = new CountThreadExecutor(executor, 10); |
|
|
|
List<TransactionStatus> lists = transactionStatusRepo.findAll(); |
|
|
|
if(isEmpty(lists)){ |
|
|
|
return; |
|
|
|
}else { |
|
|
|
logger.info("开始处理事务,本次查询待处理数据{}条", lists.size()); |
|
|
|
} |
|
|
|
Map<TransactionBizType, List<TransactionStatus>> map = lists.stream() |
|
|
|
.collect(Collectors.groupingBy(TransactionStatus::getBusinessType, Collectors.toList())); |
|
|
|
for (Map.Entry<TransactionBizType, List<TransactionStatus>> entry : map.entrySet()) { |
|
|
@@ -78,6 +83,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
switch (type) { |
|
|
|
case ISSUE_USER_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'发行:同步用户信息到老库',id:{}", list.getId()); |
|
|
|
QtkCustomerInfo customer = customerInfoRepo.findByCustomerId(list.getBusinessId()); |
|
|
|
if (customer == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -98,6 +104,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case ISSUE_VEHICLE_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'发行:同步车辆信息到老库',id:{}", list.getId()); |
|
|
|
QtkVehicleInfo vehicleInfo = vehicleInfoRepo.findByVehicleId(list.getBusinessId()); |
|
|
|
if (vehicleInfo == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -118,6 +125,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case ISSUE_CARD_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'发行:同步卡信息到老库',id:{}", list.getId()); |
|
|
|
QtkCardInfo cardInfo = cardInfoRepo.findByCardId(list.getBusinessId()); |
|
|
|
if (cardInfo == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -138,6 +146,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case ISSUE_OBU_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'发行:同步obu信息到老库',id:{}", list.getId()); |
|
|
|
QtkObuInfo obuInfo = obuInfoRepo.findByObuId(list.getBusinessId()); |
|
|
|
if (obuInfo == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -158,6 +167,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case ISSUE_ORDER_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'发行:同步订单信息到老库',id:{}", list.getId()); |
|
|
|
OisOrderSaveRequest request = new OisOrderSaveRequest(); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
IssueOrderinfo orderInfo = orderInfoRepo.findByOrderNo(list.getBusinessId()); |
|
|
@@ -192,6 +202,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case BLACK_CARD_DELETESYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'黑名单上传:同步黑名单到老库',id:{}", list.getId()); |
|
|
|
QtkBlackCard blackCard = blackCardRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
if (blackCard == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -211,6 +222,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case BLACKHIS_CARD_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'黑名单上传:同步黑名单反白到老库',id:{}", list.getId()); |
|
|
|
QtkBlackCardHis blackCardHis = blackCardHisRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
if (blackCardHis == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -229,28 +241,30 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
// 这里应该有问题,先注了 |
|
|
|
// 这里应该有问题 |
|
|
|
case BLACKHIS_CARD_DELETESYNC: |
|
|
|
// for (TransactionStatus list : lists) { |
|
|
|
// QtkBlackCardHis blackCardHis = blackCardHisRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
// if (blackCardHis == null) { |
|
|
|
// transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
// continue; |
|
|
|
// } |
|
|
|
// OisBasicDataUpdateRequest request = new OisBasicDataUpdateRequest(); |
|
|
|
// request.setBlackCardHis(blackCardHis); |
|
|
|
// //不管成功失败都删除 |
|
|
|
// try { |
|
|
|
// jsonPostRepeat(request); |
|
|
|
// transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
// } catch (Exception e) { |
|
|
|
// logger.error("同步业务id:{}出错,需人工介入",list.getId(),e); |
|
|
|
// transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'黑名单上传:同步黑名单反白到老库',id:{}", list.getId()); |
|
|
|
QtkBlackCardHis blackCardHis = blackCardHisRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
if (blackCardHis == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
OisBasicDataUpdateRequest request = new OisBasicDataUpdateRequest(); |
|
|
|
request.setBlackCardHis(blackCardHis); |
|
|
|
//不管成功失败都删除 |
|
|
|
try { |
|
|
|
jsonPostRepeat(request); |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("同步业务id:{}出错,需人工介入",list.getId(),e); |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case BLACK_OBU_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'OBU黑名单上传:同步黑名单到老库',id:{}", list.getId()); |
|
|
|
QtkBlackObu blackObu = blackObuRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
if (blackObu == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |
|
|
@@ -270,6 +284,7 @@ public class TransactionHandleManagerImpl extends AbstractCommManager implements |
|
|
|
break; |
|
|
|
case BLACKHIS_OBU_SYNC: |
|
|
|
for (TransactionStatus list : lists) { |
|
|
|
logger.info("处理'OBU黑名单上传:同步黑名单反白到老库',id:{}", list.getId()); |
|
|
|
QtkBlackObu blackObu = blackObuRepo.findById(list.getBusinessId()).orElse(null); |
|
|
|
if (blackObu == null) { |
|
|
|
transactionStatusRepo.deleteBy(list.getId()); |