admin
2021-04-28 a7454d8a6325566753358b37ffabfae2faa0ca7f
fanli/src/main/java/com/yeshi/fanli/service/impl/order/dividents/TeamDividentsSourceUserServiceImpl.java
@@ -1,62 +1,62 @@
package com.yeshi.fanli.service.impl.order.dividents;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceUserMapper;
import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser;
import com.yeshi.fanli.exception.ParamsException;
import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class TeamDividentsSourceUserServiceImpl implements TeamDividentsSourceUserService {
   @Resource
   private TeamDividentsSourceUserMapper teamDividentsSourceUserMapper;
   @Override
   public void addTeamDividentsSourceUser(TeamDividentsSourceUser teamDividentsSourceUser) throws ParamsException {
      if (teamDividentsSourceUser == null || StringUtil.isNullOrEmpty(teamDividentsSourceUser.getDay())
            || teamDividentsSourceUser.getMoney() == null || teamDividentsSourceUser.getSourceUid() == null
            || teamDividentsSourceUser.getTargetUid() == null)
         throw new ParamsException(1, "参数不完整");
      if (teamDividentsSourceUser.getCreateTime() == null)
         teamDividentsSourceUser.setCreateTime(new Date());
      teamDividentsSourceUserMapper.insertSelective(teamDividentsSourceUser);
   }
   @Override
   public BigDecimal sumMoneyByUidAndDay(Long uid, String day) {
      BigDecimal money = teamDividentsSourceUserMapper.sumMoneyByTargetUidAndDay(uid, day);
      if (money == null)
         return new BigDecimal(0);
      return money;
   }
   @Override
   public List<Long> listTargetUid(String day, int page, int pageSize) {
      return teamDividentsSourceUserMapper.listTargetUidByDay(day, (page - 1) * pageSize, pageSize);
   }
   @Override
   public List<TeamDividentsSourceUser> listBySourceUidAndDay(Long sourceUid, String day) {
      return teamDividentsSourceUserMapper.listBySourceUidAndDay(sourceUid, day);
   }
   @Override
   public long countTargetUid(String day) {
      return teamDividentsSourceUserMapper.countTargetUidByDay(day);
   }
   @Override
   public TeamDividentsSourceUser selectBySourceUidAndDayAndUid(Long sourceUid, Long targetUid, String day) {
      return teamDividentsSourceUserMapper.selectBySourceUidAndDayAndUid(sourceUid, targetUid, day);
   }
}
package com.yeshi.fanli.service.impl.order.dividents;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceUserMapper;
import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser;
import com.yeshi.fanli.exception.ParamsException;
import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class TeamDividentsSourceUserServiceImpl implements TeamDividentsSourceUserService {
   @Resource
   private TeamDividentsSourceUserMapper teamDividentsSourceUserMapper;
   @Override
   public void addTeamDividentsSourceUser(TeamDividentsSourceUser teamDividentsSourceUser) throws ParamsException {
      if (teamDividentsSourceUser == null || StringUtil.isNullOrEmpty(teamDividentsSourceUser.getDay())
            || teamDividentsSourceUser.getMoney() == null || teamDividentsSourceUser.getSourceUid() == null
            || teamDividentsSourceUser.getTargetUid() == null)
         throw new ParamsException(1, "参数不完整");
      if (teamDividentsSourceUser.getCreateTime() == null)
         teamDividentsSourceUser.setCreateTime(new Date());
      teamDividentsSourceUserMapper.insertSelective(teamDividentsSourceUser);
   }
   @Override
   public BigDecimal sumMoneyByUidAndDay(Long uid, String day,Integer type) {
      BigDecimal money = teamDividentsSourceUserMapper.sumMoneyByTargetUidAndDayAndType(uid, day,type);
      if (money == null)
         return new BigDecimal(0);
      return money;
   }
   @Override
   public List<Long> listTargetUid(String day, int page, int pageSize) {
      return teamDividentsSourceUserMapper.listTargetUidByDay(day, (page - 1) * pageSize, pageSize);
   }
   @Override
   public List<TeamDividentsSourceUser> listBySourceUidAndDay(Long sourceUid, String day) {
      return teamDividentsSourceUserMapper.listBySourceUidAndDay(sourceUid, day);
   }
   @Override
   public long countTargetUid(String day) {
      return teamDividentsSourceUserMapper.countTargetUidByDay(day);
   }
   @Override
   public TeamDividentsSourceUser selectBySourceUidAndDayAndUid(Long sourceUid, Long targetUid, String day) {
      return teamDividentsSourceUserMapper.selectBySourceUidAndDayAndUid(sourceUid, targetUid, day);
   }
}