| @@ -251,7 +251,7 @@ public class WxFinanceController extends BaseController { | |||||
| if (StringUtils.isNotBlank(record.getRemark())) { | if (StringUtils.isNotBlank(record.getRemark())) { | ||||
| receive.setRemark(record.getRemark()); | receive.setRemark(record.getRemark()); | ||||
| } | } | ||||
| wxFinanceService.invalidReceive(receive, getUser()); | |||||
| wxFinanceService.invalidReceive(receive, getUser(),"收款单作废"); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -27,7 +27,7 @@ public interface WxFinanceService { | |||||
| PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | ||||
| List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user); | List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user); | ||||
| WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | ||||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user); | |||||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user,String remark); | |||||
| void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); | void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); | ||||
| //预收款 | //预收款 | ||||
| List<WxBillBaseEntity> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | List<WxBillBaseEntity> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | ||||
| @@ -290,6 +290,11 @@ public class WxBillAdvanceServiceImpl extends WxBillBaseService implements WxBil | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillAdvanceMapper.updateById(wxBillRent); | wxBillAdvanceMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -558,6 +558,11 @@ public class WxBillDailyServiceImpl extends WxBillBaseService implements WxBillD | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillDailyMapper.updateById(wxBillRent); | wxBillDailyMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -499,6 +499,11 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillDepositMapper.updateById(wxBillRent); | wxBillDepositMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -509,6 +509,11 @@ public class WxBillOtherDepositServiceImpl extends WxBillBaseService implements | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillOtherDepositMapper.updateById(wxBillRent); | wxBillOtherDepositMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -454,6 +454,11 @@ public class WxBillOtherServiceImpl extends WxBillBaseService implements WxBillO | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillOtherMapper.updateById(wxBillRent); | wxBillOtherMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -484,6 +484,11 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillPropertyDepositMapper.updateById(wxBillRent); | wxBillPropertyDepositMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -598,6 +598,11 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillPropertyMapper.updateById(wxBillRent); | wxBillPropertyMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -511,6 +511,11 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillRentManageMapper.updateById(wxBillRent); | wxBillRentManageMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -706,6 +706,11 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); | ||||
| wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); | ||||
| if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||||
| if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { | |||||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||||
| } | |||||
| } | |||||
| wxBillRentMapper.updateById(wxBillRent); | wxBillRentMapper.updateById(wxBillRent); | ||||
| EnumBillAction action = EnumBillAction.RETURN; | EnumBillAction action = EnumBillAction.RETURN; | ||||
| this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), | ||||
| @@ -661,7 +661,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user) { | |||||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user,String remark) { | |||||
| invalidReceive(record, user, false); | |||||
| } | |||||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user,boolean isRedSetoff) { | |||||
| //如果自身是预充单,则被冲抵了就不能作废 | //如果自身是预充单,则被冲抵了就不能作废 | ||||
| if (record.getType().intValue() == EnumFinanceReceiveType.ADVANCE.getCode().intValue()) { | if (record.getType().intValue() == EnumFinanceReceiveType.ADVANCE.getCode().intValue()) { | ||||
| WxFinanceReceiveSetoff rsq0 = new WxFinanceReceiveSetoff(); | WxFinanceReceiveSetoff rsq0 = new WxFinanceReceiveSetoff(); | ||||
| @@ -673,7 +677,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"存在关联的冲抵单,请先处理"); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"存在关联的冲抵单,请先处理"); | ||||
| } | } | ||||
| } | } | ||||
| //主收款单作废 | //主收款单作废 | ||||
| record.setStatus(EnumFinanceReceiveStatus.INVALID.getCode()); | record.setStatus(EnumFinanceReceiveStatus.INVALID.getCode()); | ||||
| record.setUpdateTime(new Date()); | record.setUpdateTime(new Date()); | ||||
| @@ -706,7 +709,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| payDto.setId(bill.getId()); | payDto.setId(bill.getId()); | ||||
| payDto.setBillTypeValue(bill.getBillType()); | payDto.setBillTypeValue(bill.getBillType()); | ||||
| payDto.setAddpay(rb.getReceive()); | payDto.setAddpay(rb.getReceive()); | ||||
| payDto.setRemark("收款单作废,系统自动退回"); | |||||
| if (isRedSetoff) { | |||||
| payDto.setRemark("收款单红冲,自动回退"); | |||||
| }else { | |||||
| payDto.setRemark("收款单作废,自动回退"); | |||||
| } | |||||
| wxBillAllHelper.backPay(payDto, user); | wxBillAllHelper.backPay(payDto, user); | ||||
| }else { | }else { | ||||
| @@ -740,12 +747,19 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| @Override | @Override | ||||
| public void redSetoffReceive(WxFinanceReceive record, MallUserInfo user) { | public void redSetoffReceive(WxFinanceReceive record, MallUserInfo user) { | ||||
| //红冲 | |||||
| invalidReceive(record, user , true); | |||||
| //新增一个红冲,金额是负数 | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setReceiveMoney("-"+record.getReceiveMoney()); | |||||
| record.setSetOffMoney("-"+record.getSetOffMoney()); | |||||
| record.setStatus(EnumFinanceReceiveStatus.RED_SETOFF.getCode()); | |||||
| wxFinanceReceiveMapper.insert(record); | |||||
| } | } | ||||