diff --git a/framework/src/main/java/cn/lili/modules/goods/service/CategoryService.java b/framework/src/main/java/cn/lili/modules/goods/service/CategoryService.java index 86888589..1941fe40 100644 --- a/framework/src/main/java/cn/lili/modules/goods/service/CategoryService.java +++ b/framework/src/main/java/cn/lili/modules/goods/service/CategoryService.java @@ -4,9 +4,6 @@ package cn.lili.modules.goods.service; import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.vos.CategoryVO; import com.baomidou.mybatisplus.extension.service.IService; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import java.util.List; @@ -16,7 +13,6 @@ import java.util.List; * @author pikachu * @since 2020-03-02 16:44:56 */ -@CacheConfig(cacheNames = "{category}") public interface CategoryService extends IService { @@ -35,7 +31,6 @@ public interface CategoryService extends IService { * @param id * @return */ - @Cacheable(key = "#id") Category getCategoryById(String id); /** @@ -99,7 +94,6 @@ public interface CategoryService extends IService { * @param category 商品分类信息 * @return 修改结果 */ - @CacheEvict(key = "#category.id") void updateCategory(Category category); /** diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java index 70b29346..c262f9ff 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java @@ -19,6 +19,9 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,6 +39,7 @@ import java.util.stream.Collectors; * @since 2020-02-23 15:18:56 */ @Service +@CacheConfig(cacheNames = "{CATEGORY}") public class CategoryServiceImpl extends ServiceImpl implements CategoryService { private static final String DELETE_FLAG_COLUMN = "delete_flag"; @@ -60,6 +64,7 @@ public class CategoryServiceImpl extends ServiceImpl i } @Override + @Cacheable(key = "#id") public Category getCategoryById(String id) { return this.getById(id); } @@ -216,6 +221,7 @@ public class CategoryServiceImpl extends ServiceImpl i } @Override + @CacheEvict(key = "#category.id") @Transactional(rollbackFor = Exception.class) public void updateCategory(Category category) { //判断分类佣金是否正确 @@ -242,6 +248,7 @@ public class CategoryServiceImpl extends ServiceImpl i @Override + @CacheEvict(key = "#id") @Transactional(rollbackFor = Exception.class) public void delete(String id) { this.removeById(id); @@ -253,6 +260,7 @@ public class CategoryServiceImpl extends ServiceImpl i } @Override + @CacheEvict(key = "#categoryId") @Transactional(rollbackFor = Exception.class) public void updateCategoryStatus(String categoryId, Boolean enableOperations) { //禁用子分类 @@ -346,5 +354,6 @@ public class CategoryServiceImpl extends ServiceImpl i */ private void removeCache() { cache.remove(CachePrefix.CATEGORY.getPrefix()); + cache.remove(CachePrefix.CATEGORY_ARRAY.getPrefix()); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index c44e9de5..b6211c3c 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -709,6 +709,7 @@ public class OrderServiceImpl extends ServiceImpl implements * @return 是否成功 */ @Override + @Transactional(rollbackFor = Exception.class) public boolean checkFictitiousOrder(String pintuanId, Integer requiredNum, Boolean fictitious) { Map> collect = this.queryListByPromotion(pintuanId) .stream().collect(Collectors.groupingBy(Order::getParentOrderSn)); @@ -813,7 +814,6 @@ public class OrderServiceImpl extends ServiceImpl implements //如果为开团订单,则发布一个一小时的延时任务,时间到达后,如果未成团则自动结束(未开启虚拟成团的情况下) PintuanOrderMessage pintuanOrderMessage = new PintuanOrderMessage(); //开团结束时间 -// long startTime = DateUtil.offsetHour(new Date(), 1).getTime(); long startTime = DateUtil.offsetMinute(new Date(), 2).getTime(); pintuanOrderMessage.setOrderSn(parentOrderSn); pintuanOrderMessage.setPintuanId(pintuanId);