开票数据判断
This commit is contained in:
@ -75,25 +75,31 @@ public interface CardMapper extends BaseMapperX<CardDO> {
|
|||||||
}
|
}
|
||||||
return lastCardDO.getMoney();
|
return lastCardDO.getMoney();
|
||||||
}
|
}
|
||||||
default List<CardDO> getMoneyByUserIds(Collection<Long> userIds , String flag, String type,Integer var){
|
default List<CardDO> getMoneyByUserIds(Collection<Long> userIds , String flag, String type,Integer var,Integer var2){
|
||||||
return selectList(new LambdaQueryWrapperX<CardDO>()
|
List<CardDO> cardDOS = selectList(new LambdaQueryWrapperX<CardDO>()
|
||||||
.eq(CardDO::getFlag, flag)
|
.eq(CardDO::getFlag, flag)
|
||||||
.eq(CardDO::getType, type)
|
.eq(CardDO::getType, type)
|
||||||
.eq(CardDO::getBillingExist,var)
|
.eq(CardDO::getBillingExist, var)
|
||||||
.in(CardDO::getUserId, userIds));
|
.in(CardDO::getUserId, userIds));
|
||||||
|
if(var2==null){
|
||||||
|
return cardDOS;
|
||||||
|
}else{
|
||||||
|
return cardDOS.stream().filter(f-> f.getCreateTime().getMonth().getValue()!=var2).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default BigDecimal getTotalMoneyByuserIds(Collection<Long> userIds, String flag, String type) {
|
default BigDecimal getTotalMoneyByuserIds(Collection<Long> userIds, String flag, String type,Integer var) {
|
||||||
List<CardDO> cardDOS = selectList(new LambdaQueryWrapper<CardDO>()
|
List<CardDO> cardDOS = selectList(new LambdaQueryWrapper<CardDO>()
|
||||||
.eq(CardDO::getFlag, flag)
|
.eq(CardDO::getFlag, flag)
|
||||||
.eq(CardDO::getType, type)
|
.eq(CardDO::getType, type)
|
||||||
.eq(CardDO::getBillingExist, BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode())
|
.eq(CardDO::getBillingExist, BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode())
|
||||||
.in(CardDO::getUserId, userIds));
|
.in(CardDO::getUserId, userIds));
|
||||||
|
if(var!=null){
|
||||||
|
cardDOS=cardDOS.stream().filter(f-> f.getCreateTime().getMonth().getValue()!=var).collect(Collectors.toList());
|
||||||
|
}
|
||||||
return cardDOS.stream()
|
return cardDOS.stream()
|
||||||
.map(CardDO::getChangeMoney)
|
.map(CardDO::getChangeMoney)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.member.service.billing;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.unit.DataUnit;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
@ -235,9 +236,6 @@ public class BillingServiceImpl implements BillingService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String createBillingUnit(BillingSaveReqVO createReqVO) {
|
public String createBillingUnit(BillingSaveReqVO createReqVO) {
|
||||||
DateTime date = DateUtil.date();
|
|
||||||
int i = date.dayOfMonth();
|
|
||||||
if(i<27) throw exception(BILLING_NOT_ORDER_MOENY);
|
|
||||||
// 插入 BillingDO 对象并生成唯一主键
|
// 插入 BillingDO 对象并生成唯一主键
|
||||||
BillingDO billing = BeanUtils.toBean(createReqVO, BillingDO.class);
|
BillingDO billing = BeanUtils.toBean(createReqVO, BillingDO.class);
|
||||||
Set<Long> orderId = createReqVO.getOrderId();
|
Set<Long> orderId = createReqVO.getOrderId();
|
||||||
@ -250,7 +248,7 @@ public class BillingServiceImpl implements BillingService {
|
|||||||
// billing.setUserPhone(String.valueOf(memberGroupDO.getId()));
|
// billing.setUserPhone(String.valueOf(memberGroupDO.getId()));
|
||||||
billing.setUserId(billing.getUserId());
|
billing.setUserId(billing.getUserId());
|
||||||
//查询单位充值的金额
|
//查询单位充值的金额
|
||||||
List<CardDO> moneyByUserIds = cardMapper.getMoneyByUserIds(createReqVO.getOrderId(), CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(),BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode());
|
List<CardDO> moneyByUserIds = cardMapper.getMoneyByUserIds(createReqVO.getOrderId(), CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(),BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode(),getMonth());
|
||||||
if(CollUtil.isEmpty(moneyByUserIds))throw exception(BILLING_NOT_ORDER_EXISTS);
|
if(CollUtil.isEmpty(moneyByUserIds))throw exception(BILLING_NOT_ORDER_EXISTS);
|
||||||
BigDecimal totalMoney = moneyByUserIds.stream()
|
BigDecimal totalMoney = moneyByUserIds.stream()
|
||||||
.map(CardDO::getChangeMoney)
|
.map(CardDO::getChangeMoney)
|
||||||
@ -454,11 +452,20 @@ public class BillingServiceImpl implements BillingService {
|
|||||||
// 查询已开票的金额
|
// 查询已开票的金额
|
||||||
BigDecimal haveMoney = getTotalMoneyForBilling(userId, BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode());
|
BigDecimal haveMoney = getTotalMoneyForBilling(userId, BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode());
|
||||||
response.setHaveMoney(haveMoney);
|
response.setHaveMoney(haveMoney);
|
||||||
BigDecimal moneyByUserIds = cardMapper.getTotalMoneyByuserIds(memberList, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode());
|
|
||||||
|
BigDecimal moneyByUserIds = cardMapper.getTotalMoneyByuserIds(memberList, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(),getMonth());
|
||||||
response.setWithoutMoney(moneyByUserIds);
|
response.setWithoutMoney(moneyByUserIds);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
private Integer getMonth(){
|
||||||
|
DateTime date = DateUtil.date();
|
||||||
|
Integer month=null;
|
||||||
|
int day = date.dayOfMonth();
|
||||||
|
if(day<=26){
|
||||||
|
month= date.monthBaseOne();
|
||||||
|
}
|
||||||
|
return month;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public BillingRespMoneyVO getHaveWithoutMoney(Long userId) {
|
public BillingRespMoneyVO getHaveWithoutMoney(Long userId) {
|
||||||
List<Long> memberList = getMemberListByUserId(userId);
|
List<Long> memberList = getMemberListByUserId(userId);
|
||||||
@ -578,7 +585,8 @@ public class BillingServiceImpl implements BillingService {
|
|||||||
public BigDecimal getUserTotalMoney(BillingPageDataVo vo) {
|
public BigDecimal getUserTotalMoney(BillingPageDataVo vo) {
|
||||||
// 获取当前单位下的所有成员
|
// 获取当前单位下的所有成员
|
||||||
List<Long> ids = getMemberListByUserId(vo.getUserId());
|
List<Long> ids = getMemberListByUserId(vo.getUserId());
|
||||||
List<CardDO> moneyByUserIds = cardMapper.getMoneyByUserIds(ids, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(), BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode());
|
|
||||||
|
List<CardDO> moneyByUserIds = cardMapper.getMoneyByUserIds(ids, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(), BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode(),getMonth());
|
||||||
return moneyByUserIds.stream()
|
return moneyByUserIds.stream()
|
||||||
.map(CardDO::getChangeMoney)
|
.map(CardDO::getChangeMoney)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
|
Reference in New Issue
Block a user