Authored by gemingdan

提现分批mq

... ... @@ -234,7 +234,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
private String IS_NEED_SIGN_UP = "union.need.signup.switch";
private String RANKLIST_FROM_DATE = "union.rank.from";
private static final int SETTLEMENT_ORDER_SPLIT_NUM=800;
private static final int SETTLEMENT_ORDER_SPLIT_NUM=16;
... ... @@ -3765,37 +3765,39 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return -1;
}
int count = unionShareOrdersMapper.selectOrderNumByCondition(settlementCode);
if (count < 1) {
return -2;
}
List<UnionShareOrdersBo> orderList = new ArrayList<>();//该提现对应的订单
int size = SETTLEMENT_ORDER_SPLIT_NUM;
int page = count % size > 0 ? (count / size) + 1 : count / size;
boolean isFirst = true;
for (int i = 0; i < page; i++) {
int offset = i * size ;
List<UnionShareOrders> periodOrders = unionShareOrdersMapper.selectOrderByCondition(settlementCode, offset, size);
if (CollectionUtils.isEmpty(periodOrders) || periodOrders.get(0) == null) {
break;
}
periodOrders.forEach(o->{
UnionShareOrdersBo b = new UnionShareOrdersBo();
BeanUtils.copyProperties(o,b);
if (b.getActivityId()>0) {
b.setActivityType(2);
if (count > 0 ) {
List<UnionShareOrdersBo> orderList = new ArrayList<>();//该提现对应的订单
int page = count % size > 0 ? (count / size) + 1 : count / size;
for (int i = 0; i < page; i++) {
int offset = i * size ;
List<UnionShareOrders> periodOrders = unionShareOrdersMapper.selectOrderByCondition(settlementCode, offset, size);
if (CollectionUtils.isEmpty(periodOrders) || periodOrders.get(0) == null) {
break;
}
orderList.add(b);
});
sendSettlementMq(unionShareSettlement,orderList,null,isFirst);
isFirst = false;
orderList.clear();
periodOrders.forEach(o->{
UnionShareOrdersBo b = new UnionShareOrdersBo();
BeanUtils.copyProperties(o,b);
if (b.getActivityId()>0) {
b.setActivityType(2);
}
orderList.add(b);
});
sendSettlementMq(unionShareSettlement,orderList,null,isFirst);
isFirst = false;
orderList.clear();
}
}
//查询活动额外返的返利单
List<Integer> ids = unionShareOrdersMapper.selectIdForActivity(settlementCode);
List<UnionShareOrdersActivityBo> activityBos = new ArrayList<>();
if(CollectionUtils.isNotEmpty(ids)){
page = count % size > 0 ? (count / size) + 1 : count / size;
for (int i = 0; i < page; i++) {
count = ids.size();
int pageA = count % size > 0 ? (count / size) + 1 : count / size;
for (int i = 0; i < pageA; i++) {
int startIndex = i * size ;
int endIndex=startIndex+size-1;
List<UnionShareOrdersActivityLogs> activities = unionShareOrdersActivityLogsMapper.selectByOrderIds(ids.subList(startIndex,endIndex<count?endIndex:count-1));
... ...