fubin 1 год назад
Родитель
Сommit
ec29ed59c3

+ 9 - 2
src/main/java/com/dk/mdm/service/mac/OtherPayableService.java

@@ -289,6 +289,15 @@ public class OtherPayableService extends BaseService<OtherPayable> {
             rollbackFor = {Exception.class}
     )
     public ResponseResultVO<?> update(OtherPayableVO otherPayableVO) {
+        OtherPayable otherPayableForUpdate = otherPayableMapper.selectByIdForUpdate(otherPayableVO.getPayableId());
+        // 并发校验
+        if (!otherPayableForUpdate.getFlgValid()) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISFLGVALID_FALSE.getMessage());
+        }
+        // 期初数据不允许编辑
+        if (otherPayableForUpdate.getBusinessType() == 0) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_ISQICHU.getMessage());
+        }
         // 付款金额不能大于支出金额
         if(otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1){
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
@@ -453,8 +462,6 @@ public class OtherPayableService extends BaseService<OtherPayable> {
             /*******************************************  付款的处理 end ********************************************/
 
             /*******************************************  应付付款的处理 begin ********************************************/
-            OtherPayable otherPayableForUpdate = otherPayableMapper.selectByIdForUpdate(otherPayableVO.getPayableId());
-
             // 应付付款的处理
             RecPayHandleItem recPayHandleItem = new RecPayHandleItem();
             recPayHandleItem.setRpId(recPay.getRpId()).setAccItemId(otherPayableForUpdate.getAccItemId())

+ 9 - 1
src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java

@@ -288,6 +288,15 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
             rollbackFor = {Exception.class}
     )
     public ResponseResultVO<?> update(OtherReceivableVO otherReceivableVO) {
+        OtherReceivable otherReceivableForUpdate = otherReceivableMapper.selectByIdForUpdate(otherReceivableVO.getReceivableId());
+        // 并发校验
+        if (!otherReceivableForUpdate.getFlgValid()) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISFLGVALID_FALSE.getMessage());
+        }
+        // 期初数据不允许编辑
+        if (otherReceivableForUpdate.getBusinessType() == 0) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_ISQICHU.getMessage());
+        }
         // 收款金额不能大于收入金额
         if(otherReceivableVO.getSumAmtRec().compareTo(otherReceivableVO.getSumAmtReceivable()) == 1){
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RECEIVABLE_NO_LESS_RECEIPT.getMessage());
@@ -454,7 +463,6 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
             /***********************************  收款的处理 end ************************************/
 
             /***********************************  应收收款的处理 begin ************************************/
-            OtherReceivable otherReceivableForUpdate = otherReceivableMapper.selectByIdForUpdate(otherReceivableVO.getReceivableId());
             // 应收收款的处理
             RecPayHandleItem recPayHandleItem = new RecPayHandleItem();
             recPayHandleItem.setRpId(recPay.getRpId()).setAccItemId(otherReceivableForUpdate.getAccItemId())

+ 4 - 0
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -304,6 +304,10 @@ public class ReceiptService extends BaseService<RecPay> {
     )
     public ResponseResultVO<?> update(RecPayVO recPayVO) {
         RecPay recPayForUpdate = recPayMapper.selectByIdForUpdate(recPayVO.getRpId());
+        // 并发校验
+        if (!recPayForUpdate.getFlgValid()) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISFLGVALID_FALSE.getMessage());
+        }
         if(recPayForUpdate.getBiznisId() != null){
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_FORBID_EDIT.getMessage());
         }

+ 10 - 0
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -335,6 +335,16 @@ public class OrderService extends BaseService<Order> {
             rollbackFor = {Exception.class}
     )
     public ResponseResultVO<?> update(OrderVO orderVO) {
+        Order orderForUpdate = orderMapper.selectByIdForUpdate(orderVO.getOrderId());
+        // 并发校验
+        if (!orderForUpdate.getFlgValid()) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISFLGVALID_FALSE.getMessage());
+        }
+        // 如果全部出库了
+        if (orderForUpdate.getSumQuantity().compareTo( orderForUpdate.getOutQty()) == 0) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ORDER_IS_OUT.getMessage());
+        }
+
         // 明细实体(避免并发,需要再查一遍)
         OrderItem orderItemForUpdate;
         // 转化实体