Kaynağa Gözat

fixed 开卡赠礼赠送卡券数量限制

fushengqian 11 ay önce
ebeveyn
işleme
bce2929d3f

+ 8 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/OpenGiftServiceImpl.java

@@ -133,9 +133,13 @@ public class OpenGiftServiceImpl extends ServiceImpl<MtOpenGiftMapper, MtOpenGif
     @Override
     @Transactional(rollbackFor = Exception.class)
     @OperationServiceLog(description = "新增开卡赠礼")
-    public MtOpenGift addOpenGift(MtOpenGift mtOpenGift) {
+    public MtOpenGift addOpenGift(MtOpenGift mtOpenGift) throws BusinessCheckException {
         mtOpenGift.setUpdateTime(new Date());
         mtOpenGift.setCreateTime(new Date());
+        if (mtOpenGift.getCouponNum() != null && mtOpenGift.getCouponNum() > 100) {
+            throw new BusinessCheckException("开卡赠礼卡券数量不能大于100");
+        }
+
         this.save(mtOpenGift);
         return mtOpenGift;
     }
@@ -215,6 +219,9 @@ public class OpenGiftServiceImpl extends ServiceImpl<MtOpenGiftMapper, MtOpenGif
         }
 
         if (null != reqDto.getCouponNum()) {
+            if (reqDto.getCouponNum() > 100) {
+                throw new BusinessCheckException("开卡赠礼卡券数量不能大于100");
+            }
             mtOpenGift.setCouponNum(reqDto.getCouponNum());
         }