From 62a447d89331aee1feae7724c7616aa1bb2cfe79 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 16 十月 2024 14:28:37 +0800 Subject: [PATCH] 将CMQ替换为rabbitmq --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java | 312 ++++++++++++++++++++++++++-------------------------- 1 files changed, 156 insertions(+), 156 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 c18a993..6d73820 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 @@ -1,156 +1,156 @@ -package com.yeshi.fanli.service.impl.shop; - -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper; -import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay; -import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException; -import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService; - -@Service -public class BanLiShopGoodsSetPayServiceImpl implements BanLiShopGoodsSetPayService { - - @Resource - private BanLiShopGoodsSetsPayMapper banLiShopGoodsSetsPayMapper; - - @Override - public List<BanLiShopGoodsSetsPay> listByGoodsSetId(Long goodsSetId) { - return banLiShopGoodsSetsPayMapper.listByGoodsSetId(goodsSetId); - } - - @Override - public int countByGoodsSetId(Long goodsSetId) { - return (int) banLiShopGoodsSetsPayMapper.countByGoodsSetId(goodsSetId); - } - - @Override - public BanLiShopGoodsSetsPay selectByPrimaryKey(Long id) { - return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id); - } - - @Transactional - @Override - public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException { - if (pay.getId() == null)// 鏂板 - { - // 鍒ゆ柇鍙傛暟鏄惁榻愬叏 - if (pay.getGoodsSet() == null || pay.getGoodsSet().getId() == null) - throw new BanLiShopGoodsSetPayException(1, "濂楅涓嶅瓨鍦�"); - - if (pay.getPayType() == null) - throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氭敮浠樻柟寮�"); - - if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) { - if (pay.getHongBaoPrice() == null) - throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); - } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) { - if (pay.getBalancePrice() == null) - throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); - } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) { - if (pay.getHongBaoPrice() == null || pay.getMoneyPrice() == null) - throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); - } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) { - if (pay.getMoneyPrice() == null) - throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); - } - if (pay.getCreateTime() == null) - pay.setCreateTime(new Date()); - banLiShopGoodsSetsPayMapper.insertSelective(pay); - - if (pay.getWeight() == null) {// 鏉冮噸鏇存柊 - BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay(); - update.setId(pay.getId()); - update.setWeight((int) pay.getId().longValue()); - banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update); - } - } else {// 淇敼 - 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) { - if (pay.getId() == null) - return; - if (pay.getUpdateTime() == null) - pay.setUpdateTime(new Date()); - - banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(pay); - } - - @Transactional - @Override - public void delete(List<Long> idsList) { - if (idsList != null) - for (Long id : idsList) - deleteByPrimaryKey(id); - } - - @Override - public void deleteByPrimaryKey(Long id) { - 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); - } - - -} +package com.yeshi.fanli.service.impl.shop; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper; +import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay; +import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException; +import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService; + +@Service +public class BanLiShopGoodsSetPayServiceImpl implements BanLiShopGoodsSetPayService { + + @Resource + private BanLiShopGoodsSetsPayMapper banLiShopGoodsSetsPayMapper; + + @Override + public List<BanLiShopGoodsSetsPay> listByGoodsSetId(Long goodsSetId) { + return banLiShopGoodsSetsPayMapper.listByGoodsSetId(goodsSetId); + } + + @Override + public int countByGoodsSetId(Long goodsSetId) { + return (int) banLiShopGoodsSetsPayMapper.countByGoodsSetId(goodsSetId); + } + + @Override + public BanLiShopGoodsSetsPay selectByPrimaryKey(Long id) { + return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id); + } + + @Transactional(rollbackFor=Exception.class) + @Override + public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException { + if (pay.getId() == null)// 鏂板 + { + // 鍒ゆ柇鍙傛暟鏄惁榻愬叏 + if (pay.getGoodsSet() == null || pay.getGoodsSet().getId() == null) + throw new BanLiShopGoodsSetPayException(1, "濂楅涓嶅瓨鍦�"); + + if (pay.getPayType() == null) + throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氭敮浠樻柟寮�"); + + if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) { + if (pay.getHongBaoPrice() == null) + throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); + } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) { + if (pay.getBalancePrice() == null) + throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); + } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) { + if (pay.getHongBaoPrice() == null || pay.getMoneyPrice() == null) + throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); + } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) { + if (pay.getMoneyPrice() == null) + throw new BanLiShopGoodsSetPayException(1, "璇锋寚瀹氫环鏍�"); + } + if (pay.getCreateTime() == null) + pay.setCreateTime(new Date()); + banLiShopGoodsSetsPayMapper.insertSelective(pay); + + if (pay.getWeight() == null) {// 鏉冮噸鏇存柊 + BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay(); + update.setId(pay.getId()); + update.setWeight((int) pay.getId().longValue()); + banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update); + } + } else {// 淇敼 + 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) { + if (pay.getId() == null) + return; + if (pay.getUpdateTime() == null) + pay.setUpdateTime(new Date()); + + banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(pay); + } + + @Transactional + @Override + public void delete(List<Long> idsList) { + if (idsList != null) + for (Long id : idsList) + deleteByPrimaryKey(id); + } + + @Override + public void deleteByPrimaryKey(Long id) { + 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