|
@@ -110,13 +110,15 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean cancellation(Long id) {
|
|
|
+ public Boolean cancellation(FinanceInvoice financeInvoice) {
|
|
|
+ Long id = financeInvoice.getId();
|
|
|
FinanceInvoice invoice = this.getById(id);
|
|
|
- if (invoice.getState().equals(FinanceInvoiceState.已开票.name())){
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"此开票申请已开票,无法作废。请联系财务同事确认。");
|
|
|
+ if (!invoice.getState().equals(FinanceInvoiceState.已开票.name())){
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"此发票还未开具,无法申请作废。");
|
|
|
}
|
|
|
-
|
|
|
- return this.update(new LambdaUpdateWrapper<FinanceInvoice>().set(FinanceInvoice::getState, FinanceInvoiceState.作废).eq(BaseEntity::getId,id));
|
|
|
+ return this.update(new LambdaUpdateWrapper<FinanceInvoice>().set(FinanceInvoice::getState, FinanceInvoiceState.申请作废)
|
|
|
+ .set(FinanceInvoice::getReason,financeInvoice.getReason())
|
|
|
+ .eq(BaseEntity::getId,id));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -130,4 +132,15 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
|
|
|
}
|
|
|
return financeInvoiceMapper.getInvoiceAmountInfo(simpleDTO);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean cancelling(Long id) {
|
|
|
+ FinanceInvoice invoice = this.getById(id);
|
|
|
+ if (!invoice.getState().equals(FinanceInvoiceState.申请作废.name())){
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"发票状态错误,无法作废。");
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.update(new LambdaUpdateWrapper<FinanceInvoice>().set(FinanceInvoice::getState, FinanceInvoiceState.已作废).eq(BaseEntity::getId,id));
|
|
|
+
|
|
|
+ }
|
|
|
}
|