sunkean 3 years ago
parent
commit
f2d0d9b404

+ 2 - 0
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -275,6 +275,7 @@ public class AssetService {
 
     public synchronized void consignment(Long id, BigDecimal price, String tradeCode) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        boolean publicShow = asset.isPublicShow();
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
         }
@@ -363,6 +364,7 @@ public class AssetService {
         asset.setPublicCollectionId(collection.getId());
         asset.setSellPrice(price);
         assetRepo.save(asset);
+        asset.setPublicShow(publicShow);
         assetSuperimpositionService.adjustNum(asset, AssetOperationType.CONSIGNMENT, null);
     }
 

+ 4 - 2
src/main/java/com/izouma/nineth/service/AssetSuperimpositionService.java

@@ -68,9 +68,11 @@ public class AssetSuperimpositionService {
                 // 关闭公开展示同时取消已经寄售的数量
                 if (asset.isConsignment()) {
                     assetSuperimposition.setConsignmentNum(assetSuperimposition.getConsignmentNum() - NUM);
+                    assetSuperimposition.setCloseShowNum(assetSuperimposition.getCloseShowNum() + NUM);
+                } else {
+                    assetSuperimposition.setCloseShowNum(assetSuperimposition.getCloseShowNum() + NUM);
+                    assetSuperimposition.setOpenShowNum(assetSuperimposition.getOpenShowNum() - NUM);
                 }
-                assetSuperimposition.setCloseShowNum(assetSuperimposition.getCloseShowNum() + NUM);
-                assetSuperimposition.setOpenShowNum(assetSuperimposition.getOpenShowNum() - NUM);
                 break;
             case CONSIGNMENT:
                 log.info("调整数量 -> 寄售");