From 60a099a7edfd81a3b10c766e113c019cdef6cd3d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 13 五月 2020 16:08:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
index 61319bf..c0d56d7 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
@@ -34,7 +34,7 @@
return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id);
}
- @Transactional
+ @Transactional(rollbackFor=Exception.class)
@Override
public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException {
if (pay.getId() == null)// 鏂板
@@ -73,6 +73,50 @@
updateSelectiveByPrimaryKey(pay);
}
}
+
+ @Override
+ public void saveObject(BanLiShopGoodsSetsPay record) throws BanLiShopGoodsSetPayException {
+ // 鍒ゆ柇鍙傛暟鏄惁榻愬叏
+ if (record.getGoodsSet() == null || record.getGoodsSet().getId() == null)
+ throw new BanLiShopGoodsSetPayException(1, "濂楅涓嶅瓨鍦�");
+
+ if (record.getPayType() == null)
+ throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氭敮浠樻柟寮�");
+
+ if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) {
+ if (record.getHongBaoPrice() == null)
+ throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氱孩鍖呮敮浠樹环鏍�");
+ } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) {
+ if (record.getBalancePrice() == null)
+ throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫綑棰濇敮浠樹环鏍�");
+ } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) {
+ if (record.getHongBaoPrice() == null || record.getMoneyPrice() == null)
+ throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氱孩鍖呫�佺幇閲戞敮浠樹环鏍�");
+ } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) {
+ if (record.getMoneyPrice() == null)
+ throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氱幇閲戞敮浠樹环鏍�");
+ }
+
+ record.setUpdateTime(new Date());
+ if (record.getId() == null) {
+ record.setCreateTime(new Date());
+ banLiShopGoodsSetsPayMapper.insertSelective(record);
+
+ if (record.getWeight() == null) {// 鏉冮噸鏇存柊
+ BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay();
+ update.setId(record.getId());
+ update.setWeight((int) record.getId().longValue());
+ banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update);
+ }
+ } else {
+ BanLiShopGoodsSetsPay resultObj = banLiShopGoodsSetsPayMapper.selectByPrimaryKey(record.getId());
+ if (resultObj == null)
+ throw new BanLiShopGoodsSetPayException(1, "淇敼鍐呭宸蹭笉瀛樺湪");
+
+ record.setCreateTime(resultObj.getCreateTime());
+ banLiShopGoodsSetsPayMapper.updateByPrimaryKey(record);
+ }
+ }
@Override
public void updateSelectiveByPrimaryKey(BanLiShopGoodsSetsPay pay) {
@@ -97,4 +141,16 @@
banLiShopGoodsSetsPayMapper.deleteByPrimaryKey(id);
}
+
+ @Override
+ public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType, Long setId) {
+ return banLiShopGoodsSetsPayMapper.listQuery((page - 1) * pageSize, pageSize, key, payType, setId);
+ }
+
+ @Override
+ public long countQuery(String key, Integer payType, Long setId) {
+ return banLiShopGoodsSetsPayMapper.countQuery(key, payType, setId);
+ }
+
+
}
--
Gitblit v1.8.0