修改,部门下没用户的情况

This commit is contained in:
qjq
2024-12-03 14:21:51 +08:00
parent bc8173e7d4
commit 4015e243da
3 changed files with 20 additions and 7 deletions

View File

@ -154,7 +154,7 @@ public interface ErrorCodeConstants {
ErrorCode BILLING_NOT_COMPLETE = new ErrorCode(1_004_023_00, "还有金额未开票");
ErrorCode BILLING_NOT_EXISTS = new ErrorCode(1_004_023_00, "开票记录不存在");
ErrorCode BILLING_NOT_ORDER_EXISTS= new ErrorCode(1_004_023_00, "该时间段没有订单可开票");
ErrorCode BILLING_NOT_ORDER_MOENY= new ErrorCode(1_004_023_00, "27号(包含27号)以后才能开票");
ErrorCode BILLING_NOT_ORDER_USER= new ErrorCode(1_004_025_00, "该部门下没有用户");
ErrorCode BILLING_NOT_ORDER_REFUSE= new ErrorCode(1_004_024_00, "拒绝理由不能为空");
ErrorCode BILLING_NOT_ORDER_SECURITY= new ErrorCode(1_004_023_41, "没有权限给单位统一开票");
ErrorCode CAROUSEL_NOT_EXISTS = new ErrorCode(1_004_025_00, "小程序轮播图不存在");

View File

@ -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;
}

View File

@ -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)