|
|
@@ -213,7 +213,10 @@ public class AccountService extends BaseService<Account> {
|
|
|
if (outbound.getReceivableId() != null) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISACC.getMessage());
|
|
|
}
|
|
|
-
|
|
|
+ // 账务日期不能为空
|
|
|
+ if (outbound.getOutDate() == null) {
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ACC_DATE_ISNULL.getMessage());
|
|
|
+ }
|
|
|
// 插入账款明细
|
|
|
accountItemInsert.setAccItemType(Constant.accItemType.YING_SHOU.getName())
|
|
|
.setObjectId(objectId).setOrgId(outbound.getOrgId()).setStaffId(outbound.getStaffId())
|
|
|
@@ -224,9 +227,11 @@ public class AccountService extends BaseService<Account> {
|
|
|
accountItemMapper.insert(accountItemInsert);
|
|
|
|
|
|
// 更新出库单上的账款明细Id
|
|
|
- Outbound outboundUpdate = new Outbound();
|
|
|
- outboundUpdate.setReceivableId(accountItemInsert.getItemId()).setOutId(invoiceId);
|
|
|
- outboundService.updateByUuid(outboundUpdate);
|
|
|
+ LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(Outbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Outbound::getOutId, UUID.fromString(invoiceId));
|
|
|
+ outboundMapper.update(null, updateWrapper);
|
|
|
+ } else if ("t_mac_income".equals(biznisType)) {
|
|
|
+ // 其它收入单 todo
|
|
|
}
|
|
|
|
|
|
// 更新账款总表上的总应收账款和总剩余应收
|
|
|
@@ -268,6 +273,8 @@ public class AccountService extends BaseService<Account> {
|
|
|
LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(Outbound::getReceivableId, null).eq(Outbound::getOutId, UUID.fromString(invoiceId));
|
|
|
outboundMapper.update(null, updateWrapper);
|
|
|
+ } else if ("t_mac_income".equals(biznisType)) {
|
|
|
+ // 其它支出单 todo
|
|
|
}
|
|
|
|
|
|
// 删除账款明细
|
|
|
@@ -301,9 +308,12 @@ public class AccountService extends BaseService<Account> {
|
|
|
if (inbound.getReceivableId() != null) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISACC.getMessage());
|
|
|
}
|
|
|
-
|
|
|
+ // 账务日期不能为空
|
|
|
+ if (inbound.getIntoDate() == null) {
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ACC_DATE_ISNULL.getMessage());
|
|
|
+ }
|
|
|
// 插入账款明细
|
|
|
- accountItemInsert.setAccItemType(Constant.accItemType.YING_SHOU.getName())
|
|
|
+ accountItemInsert.setAccItemType(Constant.accItemType.YING_FU.getName())
|
|
|
.setObjectId(objectId).setOrgId(inbound.getOrgId()).setStaffId(inbound.getStaffId())
|
|
|
.setAccDate(inbound.getIntoDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName())
|
|
|
.setAmtShould(inbound.getIntoAmt()).setAmtResidue(inbound.getIntoAmt())
|
|
|
@@ -312,9 +322,11 @@ public class AccountService extends BaseService<Account> {
|
|
|
accountItemMapper.insert(accountItemInsert);
|
|
|
|
|
|
// 更新出库单上的账款明细Id
|
|
|
- Inbound inboundUpdate = new Inbound();
|
|
|
- inboundUpdate.setReceivableId(accountItemInsert.getItemId()).setIntoId(invoiceId);
|
|
|
- inboundService.updateByUuid(inboundUpdate);
|
|
|
+ LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(Inbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
|
|
|
+ inboundMapper.update(null, updateWrapper);
|
|
|
+ } else if ("t_mac_outlay".equals(biznisType)) {
|
|
|
+ // 其它支出单 todo
|
|
|
}
|
|
|
|
|
|
// 更新账款总表上的总应收账款和总剩余应收
|
|
|
@@ -352,10 +364,12 @@ public class AccountService extends BaseService<Account> {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISHANDLE.getMessage());
|
|
|
}
|
|
|
|
|
|
- // 将出库单上的账款明细Id更为null
|
|
|
+ // 将入库单上的账款明细Id更为null
|
|
|
LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(Inbound::getReceivableId, null).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
|
|
|
inboundMapper.update(null, updateWrapper);
|
|
|
+ } else if ("t_mac_outlay".equals(biznisType)) {
|
|
|
+ // 其它支出单 todo
|
|
|
}
|
|
|
|
|
|
// 删除账款明细
|