修改,部门下没用户的情况
This commit is contained in:
@ -9,8 +9,10 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class BillingRespMoneyVO {
|
||||
|
||||
@Schema(description = "发票编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "已开票金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal haveMoney;
|
||||
@Schema(description = "可开票金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal withoutMoney;
|
||||
|
||||
@Schema(description = "当月充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal mothMoney;
|
||||
}
|
||||
@ -41,6 +41,7 @@ import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailS
|
||||
import cn.iocoder.yudao.module.system.api.carteen.CarteenApi;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -239,9 +240,10 @@ public class BillingServiceImpl implements BillingService {
|
||||
// 插入 BillingDO 对象并生成唯一主键
|
||||
BillingDO billing = BeanUtils.toBean(createReqVO, BillingDO.class);
|
||||
Set<Long> orderId = createReqVO.getOrderId();
|
||||
if(orderId==null){
|
||||
/*if(orderId==null){
|
||||
createReqVO.setOrderId(new HashSet<>(getMemberListByUserId(billing.getUserId()))) ;
|
||||
}
|
||||
}*/
|
||||
if(CollUtil.isEmpty(orderId))throw exception(BILLING_NOT_ORDER_USER);
|
||||
// MemberGroupDO memberGroupDO = memberGroupDO(billing.getUserId());
|
||||
billing.setId(IdUtil.getSnowflakeNextId() + "");
|
||||
// billing.setUserName(memberGroupDO.getName());
|
||||
@ -452,9 +454,16 @@ public class BillingServiceImpl implements BillingService {
|
||||
// 查询已开票的金额
|
||||
BigDecimal haveMoney = getTotalMoneyForBilling(userId, BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode());
|
||||
response.setHaveMoney(haveMoney);
|
||||
|
||||
if(CollUtil.isEmpty(memberList)){
|
||||
response.setWithoutMoney(new BigDecimal(0));
|
||||
response.setMothMoney(new BigDecimal(0));
|
||||
return response;
|
||||
}
|
||||
BigDecimal moneyByUserIds = cardMapper.getTotalMoneyByuserIds(memberList, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(),getMonth());
|
||||
int i = DateUtil.date().monthBaseOne();
|
||||
BigDecimal month = cardMapper.getTotalMoneyByuserIds(memberList, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(),i);
|
||||
response.setWithoutMoney(moneyByUserIds);
|
||||
response.setMothMoney(month);
|
||||
return response;
|
||||
}
|
||||
private Integer getMonth(){
|
||||
@ -585,7 +594,9 @@ public class BillingServiceImpl implements BillingService {
|
||||
public BigDecimal getUserTotalMoney(BillingPageDataVo vo) {
|
||||
// 获取当前单位下的所有成员
|
||||
List<Long> ids = getMemberListByUserId(vo.getUserId());
|
||||
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
List<CardDO> moneyByUserIds = cardMapper.getMoneyByUserIds(ids, CardDO.ADD, CostTypeEnum.ADMIN_PAY.getCode(), BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode(),getMonth());
|
||||
return moneyByUserIds.stream()
|
||||
.map(CardDO::getChangeMoney)
|
||||
|
||||
Reference in New Issue
Block a user