...
|
...
|
@@ -239,6 +239,7 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
bo.getProductList().forEach(p->{
|
|
|
UnionShareOrdersProduct insertPro = new UnionShareOrdersProduct();
|
|
|
BeanUtils.copyProperties(p, insertPro);
|
|
|
insertPro.setOrderCode(bo.getOrderCode());
|
|
|
unionShareOrdersProductMapper.insertSelective(insertPro);
|
|
|
});
|
|
|
logger.info("insertOrder end,req is {}",bo);
|
...
|
...
|
@@ -281,32 +282,32 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
* 提现
|
|
|
*/
|
|
|
@Override
|
|
|
public void addSettlement(Integer uid) {
|
|
|
public BigDecimal addSettlement(Integer uid) {
|
|
|
logger.info("addSettlement enter,uid is {}",uid);
|
|
|
if (uid == null ) {
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
//查询该用户是否为特邀用户
|
|
|
int count = unionShareUserMapper.selectCountByUid(uid);
|
|
|
if (count == 0) {
|
|
|
//不是特邀用户
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
//查询是否有处理中的提现
|
|
|
if (hasSettlement(uid)) {
|
|
|
//有处理中的提现单,不可提现
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//查询当前是否有可提现的订单
|
|
|
int orderCount = unionShareOrdersMapper.selectCountByCondition(uid,ShareOrdersStatusEnum.CAN_SETTLE.getCode());
|
|
|
if (orderCount == 0 ) {
|
|
|
//没有可以提现的订单
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
//todo 生成取现单,绑定订单,考虑是否异步操作
|
|
|
relateSettlementAndOrder(uid);
|
|
|
|
|
|
BigDecimal amount = relateSettlementAndOrder(uid);
|
|
|
return amount;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -392,7 +393,7 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
/**
|
|
|
* 提现关联订单
|
|
|
* */
|
|
|
public void relateSettlementAndOrder(int uid) {
|
|
|
public BigDecimal relateSettlementAndOrder(int uid) {
|
|
|
|
|
|
//生成提现编号
|
|
|
String settlementCode = createSettlementCode();
|
...
|
...
|
@@ -401,7 +402,7 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
int updateTime = DateUtil.getCurrentTimeSecond();
|
|
|
int count=unionShareOrdersMapper.updateStatusByUid(uid,settlementCode, ShareOrdersStatusEnum.CAN_SETTLE.getCode(), ShareOrdersStatusEnum.SETTLE.getCode(), updateTime);
|
|
|
if (count == 0) {
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
//计算提现金额
|
|
|
BigDecimal totalAmount=unionShareOrdersMapper.selectAmountBySettleCode(uid, settlementCode);
|
...
|
...
|
@@ -431,7 +432,7 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
orderCodes.addAll(periodOrders);
|
|
|
}
|
|
|
if (orderCodes.size() == 0) {
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -443,6 +444,7 @@ public class UnionShareServiceImpl implements IUnionShareService { |
|
|
BeanUtils.copyProperties(insertReq,bo);
|
|
|
bo.setOrderCodes(orderCodes);
|
|
|
yhProducer.send(SETTLEMENT_TOPIC, bo);
|
|
|
return totalAmount;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|