|
@@ -23,11 +23,9 @@ import com.dk.mdm.model.pojo.mst.MoneyAccount;
|
|
|
import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
|
|
import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
|
|
|
import com.dk.mdm.model.query.mac.OtherPayableItemQuery;
|
|
import com.dk.mdm.model.query.mac.OtherPayableItemQuery;
|
|
|
import com.dk.mdm.model.query.mac.OtherPayableQuery;
|
|
import com.dk.mdm.model.query.mac.OtherPayableQuery;
|
|
|
|
|
+import com.dk.mdm.model.query.mac.RecPayHandleItemQuery;
|
|
|
import com.dk.mdm.model.query.mac.RecPayItemQuery;
|
|
import com.dk.mdm.model.query.mac.RecPayItemQuery;
|
|
|
-import com.dk.mdm.model.response.mac.OtherPayableItemResponse;
|
|
|
|
|
-import com.dk.mdm.model.response.mac.OtherPayableResponse;
|
|
|
|
|
-import com.dk.mdm.model.response.mac.RecPayItemResponse;
|
|
|
|
|
-import com.dk.mdm.model.response.mac.RecPayResponse;
|
|
|
|
|
|
|
+import com.dk.mdm.model.response.mac.*;
|
|
|
import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
|
|
import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
|
|
|
import com.dk.mdm.model.vo.mac.OtherPayableVO;
|
|
import com.dk.mdm.model.vo.mac.OtherPayableVO;
|
|
|
import com.dk.mdm.model.vo.mac.RecPayItemVO;
|
|
import com.dk.mdm.model.vo.mac.RecPayItemVO;
|
|
@@ -148,7 +146,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
)
|
|
)
|
|
|
public ResponseResultVO<?> insert(OtherPayableVO otherPayableVO) {
|
|
public ResponseResultVO<?> insert(OtherPayableVO otherPayableVO) {
|
|
|
// 付款金额不能大于支出金额
|
|
// 付款金额不能大于支出金额
|
|
|
- if(otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1){
|
|
|
|
|
|
|
+ if (otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -268,9 +266,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
|
|
|
|
|
// 更新前的最后校验
|
|
// 更新前的最后校验
|
|
|
// 剩余应付为负数,则不能保存
|
|
// 剩余应付为负数,则不能保存
|
|
|
- if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
+// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
+// }
|
|
|
// 可用金额为负数,则不能保存
|
|
// 可用金额为负数,则不能保存
|
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
@@ -300,13 +298,13 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_ISQICHU.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_ISQICHU.getMessage());
|
|
|
}
|
|
}
|
|
|
// 付款金额不能大于支出金额
|
|
// 付款金额不能大于支出金额
|
|
|
- if(otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1){
|
|
|
|
|
|
|
+ if (otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/******************************************* 应付付款的处理 begin ********************************************/
|
|
/******************************************* 应付付款的处理 begin ********************************************/
|
|
|
RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId(), false);
|
|
RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId(), false);
|
|
|
- if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
|
|
|
|
|
|
|
+ if (recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
|
|
|
// 查出并锁定所有应付核销明细
|
|
// 查出并锁定所有应付核销明细
|
|
|
AccountItem accountItemForUpdate;
|
|
AccountItem accountItemForUpdate;
|
|
|
List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
|
|
List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
|
|
@@ -339,9 +337,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
|
|
|
|
|
// 更新前的最后校验
|
|
// 更新前的最后校验
|
|
|
// 剩余应付为负数,则不能保存
|
|
// 剩余应付为负数,则不能保存
|
|
|
- if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
+// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
+// }
|
|
|
// 可用金额为负数,则不能保存
|
|
// 可用金额为负数,则不能保存
|
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
@@ -497,9 +495,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
|
|
|
|
|
// 更新前的最后校验
|
|
// 更新前的最后校验
|
|
|
// 剩余应付为负数,则不能保存
|
|
// 剩余应付为负数,则不能保存
|
|
|
- if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
|
|
+// throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
|
|
+// }
|
|
|
// 可用金额为负数,则不能保存
|
|
// 可用金额为负数,则不能保存
|
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
@@ -518,6 +516,29 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
public ResponseResultVO<?> getOtherPayableForUpdate(String id) {
|
|
public ResponseResultVO<?> getOtherPayableForUpdate(String id) {
|
|
|
Map<String, Object> dataInfo = new HashMap<>();
|
|
Map<String, Object> dataInfo = new HashMap<>();
|
|
|
OtherPayableResponse otherPayableResponse = otherPayableMapper.selectById(id);
|
|
OtherPayableResponse otherPayableResponse = otherPayableMapper.selectById(id);
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否能大编辑
|
|
|
|
|
+ otherPayableResponse.setDaEdit(true);
|
|
|
|
|
+ if (otherPayableResponse.getAccItemId() != null) {
|
|
|
|
|
+ // 查出新建时是否付款了
|
|
|
|
|
+ RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
|
|
|
|
|
+ // 查出有多少次付款
|
|
|
|
|
+ List<RecPayHandleItemResponse> RecPayHandleItemResponseList = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setAccItemId(otherPayableResponse.getAccItemId()));
|
|
|
|
|
+ if (RecPayHandleItemResponseList != null && RecPayHandleItemResponseList.size() > 0) {
|
|
|
|
|
+ // 如果有付款,并且新建时没付款,则不能大编辑
|
|
|
|
|
+ if(recPayForUpdate == null){
|
|
|
|
|
+ otherPayableResponse.setDaEdit(false);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ for(RecPayHandleItemResponse recPayHandleItemResponse :RecPayHandleItemResponseList){
|
|
|
|
|
+ // 如果核销id不是第一次付款id,不能大编辑
|
|
|
|
|
+ if(!recPayHandleItemResponse.getRpId().equals(recPayForUpdate.getRpId())){
|
|
|
|
|
+ otherPayableResponse.setDaEdit(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 支出明细
|
|
|
dataInfo.put("data", otherPayableResponse);
|
|
dataInfo.put("data", otherPayableResponse);
|
|
|
|
|
|
|
|
// 商品明细
|
|
// 商品明细
|
|
@@ -551,7 +572,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
|
|
|
|
|
|
|
|
/******************************************* 应付付款的处理 begin ********************************************/
|
|
/******************************************* 应付付款的处理 begin ********************************************/
|
|
|
RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
|
|
RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
|
|
|
- if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
|
|
|
|
|
|
|
+ if (recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
|
|
|
// 查出并锁定所有应付核销明细
|
|
// 查出并锁定所有应付核销明细
|
|
|
AccountItem accountItemForUpdate;
|
|
AccountItem accountItemForUpdate;
|
|
|
List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
|
|
List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
|