yujian
2020-04-23 2bd2200f209ddb7bcc59b636d9de6f8b3f762958
fanli/src/main/java/com/yeshi/fanli/service/impl/order/dividents/TeamDividentsSourceOrderServiceImpl.java
@@ -1,7 +1,7 @@
package com.yeshi.fanli.service.impl.order.dividents;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -22,7 +22,7 @@
   private TeamDividentsSourceOrderMapper teamDividentsSourceOrderMapper;
   @Override
   public void addTeamDividentsSourceOrder(TeamDividentsSourceOrder order)
   public TeamDividentsSourceOrder addTeamDividentsSourceOrder(TeamDividentsSourceOrder order)
         throws TeamDividentsSourceOrderException, ParamsException {
      if (order == null || order.getMoney() == null || StringUtil.isNullOrEmpty(order.getOrderNo())
            || order.getSourceType() == null || order.getState() == null || order.getUid() == null
@@ -36,31 +36,8 @@
      if (order.getCreateTime() == null)
         order.setCreateTime(new Date());
      teamDividentsSourceOrderMapper.insertSelective(order);
   }
   @Override
   public List<TeamDividentsSourceOrder> listCanSendByUidAndPreSendTime(Long uid, Date preSendTime, int page,
         int pageSize) {
      return teamDividentsSourceOrderMapper.lisByUidAndPreSendTimeAndState(uid, preSendTime,
            TeamDividentsSourceOrder.STATE_CAN_SEND, (page - 1) * pageSize, pageSize);
   }
   @Override
   public long countCanSendByUidAndPreSendTime(Long uid, Date preSendTime) {
      return teamDividentsSourceOrderMapper.countByUidAndPreSendTimeAndState(uid, preSendTime,
            TeamDividentsSourceOrder.STATE_CAN_SEND);
   }
   @Override
   public List<Long> listCanSendUidByPreSendTime(Date preSendTime, int page, int pageSize) {
      return teamDividentsSourceOrderMapper.listUidByPreSendTimeAndState(preSendTime,
            TeamDividentsSourceOrder.STATE_CAN_SEND, (page - 1) * pageSize, pageSize);
   }
   @Override
   public Long countCanSendUidByPreSendTime(Date preSendTime) {
      return teamDividentsSourceOrderMapper.countUidByPreSendTimeAndState(preSendTime,
            TeamDividentsSourceOrder.STATE_CAN_SEND);
      return order;
   }
   @Override
@@ -112,4 +89,38 @@
   }
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void orderSettle(String orderNo, int sourceType, Date preSendTime, BigDecimal income) {
      TeamDividentsSourceOrder order = selectByOrderNoSourceType(orderNo, sourceType);
      if (order == null)
         return;
      if (order.getState() == TeamDividentsSourceOrder.STATE_UNKOWN) {
         TeamDividentsSourceOrder update = new TeamDividentsSourceOrder();
         update.setId(order.getId());
         update.setMoney(income);
         update.setState(TeamDividentsSourceOrder.STATE_CAN_SEND);
         update.setPreSendTime(preSendTime);
         update.setUpdateTime(new Date());
         teamDividentsSourceOrderMapper.updateByPrimaryKeySelective(update);
      }
   }
   @Override
   public void updateMoney(String orderNo, int sourceType, BigDecimal money) {
      TeamDividentsSourceOrder order = selectByOrderNoSourceType(orderNo, sourceType);
      if (order == null)
         return;
      if (order.getState() == TeamDividentsSourceOrder.STATE_UNKOWN) {
         TeamDividentsSourceOrder update = new TeamDividentsSourceOrder();
         update.setId(order.getId());
         update.setMoney(money);
         update.setUpdateTime(new Date());
         teamDividentsSourceOrderMapper.updateByPrimaryKeySelective(update);
      }
   }
}