优化一些配置项,优化部分路基

This commit is contained in:
Chopper 2022-01-11 17:34:48 +08:00
parent 0460e219f9
commit 05818baf7a
7 changed files with 33 additions and 8 deletions

View File

@ -69,10 +69,10 @@ spring:
url: jdbc:mysql://127.0.0.1:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://127.0.0.1:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root username: root
password: lilishop password: lilishop
maxActive: 20 maxActive: 50
initialSize: 5 initialSize: 10
maxWait: 60000 maxWait: 60000
minIdle: 5 minIdle: 10
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL

View File

@ -72,8 +72,8 @@ spring:
url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root username: root
password: lilishop password: lilishop
maxActive: 20 maxActive: 50
initialSize: 5 initialSize: 20
maxWait: 60000 maxWait: 60000
minIdle: 5 minIdle: 5
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000

View File

@ -4,7 +4,11 @@ package cn.lili.modules.goods.service;
import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.vos.CategoryVO; import cn.lili.modules.goods.entity.vos.CategoryVO;
import com.baomidou.mybatisplus.extension.service.IService; 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.io.Serializable;
import java.util.List; import java.util.List;
/** /**
@ -13,6 +17,7 @@ import java.util.List;
* @author pikachu * @author pikachu
* @since 2020-03-02 16:44:56 * @since 2020-03-02 16:44:56
*/ */
@CacheConfig(cacheNames = "{category}")
public interface CategoryService extends IService<Category> { public interface CategoryService extends IService<Category> {
@ -25,6 +30,15 @@ public interface CategoryService extends IService<Category> {
*/ */
List<Category> dbList(String parentId); List<Category> dbList(String parentId);
/**
* 获取分类
*
* @param id
* @return
*/
@Cacheable(key = "#id")
Category getCategoryById(String id);
/** /**
* 根据分类id集合获取所有分类根据层级排序 * 根据分类id集合获取所有分类根据层级排序
* *
@ -86,6 +100,7 @@ public interface CategoryService extends IService<Category> {
* @param category 商品分类信息 * @param category 商品分类信息
* @return 修改结果 * @return 修改结果
*/ */
@CacheEvict(key = "#category.id")
void updateCategory(Category category); void updateCategory(Category category);
/** /**

View File

@ -60,6 +60,11 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
return this.list(new LambdaQueryWrapper<Category>().eq(Category::getParentId, parentId)); return this.list(new LambdaQueryWrapper<Category>().eq(Category::getParentId, parentId));
} }
@Override
public Category getCategoryById(String id) {
return this.getById(id);
}
/** /**
* 根据分类id集合获取所有分类根据层级排序 * 根据分类id集合获取所有分类根据层级排序
* *

View File

@ -127,9 +127,7 @@ public class TradeBuilder {
for (CartRenderStep render : cartRenderSteps) { for (CartRenderStep render : cartRenderSteps) {
try { try {
if (render.step().equals(step)) { if (render.step().equals(step)) {
Date date = new Date();
render.render(tradeDTO); render.render(tradeDTO);
log.error(render.getClass().getName() + "-" + (System.currentTimeMillis() - date.getTime()));
} }
} catch (ServiceException e) { } catch (ServiceException e) {
throw e; throw e;

View File

@ -66,7 +66,7 @@ public class CommissionRender implements CartRenderStep {
String categoryId = cartSkuVO.getGoodsSku().getCategoryPath() String categoryId = cartSkuVO.getGoodsSku().getCategoryPath()
.substring(cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1); .substring(cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1);
if (CharSequenceUtil.isNotEmpty(categoryId)) { if (CharSequenceUtil.isNotEmpty(categoryId)) {
Double commissionRate = categoryService.getById(categoryId).getCommissionRate(); Double commissionRate = categoryService.getCategoryById(categoryId).getCommissionRate();
priceDetailDTO.setPlatFormCommissionPoint(commissionRate); priceDetailDTO.setPlatFormCommissionPoint(commissionRate);
} }

View File

@ -5,6 +5,9 @@ import cn.lili.modules.store.entity.dos.FreightTemplate;
import cn.lili.modules.store.entity.vos.FreightTemplateVO; import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; 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; import java.util.List;
@ -14,6 +17,7 @@ import java.util.List;
* @author Bulbasaur * @author Bulbasaur
* @since 2020-03-07 09:24:33 * @since 2020-03-07 09:24:33
*/ */
@CacheConfig(cacheNames = "{freightTemplate}")
public interface FreightTemplateService extends IService<FreightTemplate> { public interface FreightTemplateService extends IService<FreightTemplate> {
/** /**
@ -38,6 +42,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param id 运费模板ID * @param id 运费模板ID
* @return 运费模板 * @return 运费模板
*/ */
@Cacheable(key = "#id")
FreightTemplateVO getFreightTemplate(String id); FreightTemplateVO getFreightTemplate(String id);
/** /**
@ -55,6 +60,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param freightTemplateVO 运费模板 * @param freightTemplateVO 运费模板
* @return 运费模板 * @return 运费模板
*/ */
@CacheEvict(key = "#freightTemplateVO.id")
FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO); FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO);
/** /**
@ -64,6 +70,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param id 运费模板ID * @param id 运费模板ID
* @return 操作状态 * @return 操作状态
*/ */
@CacheEvict(key = "#freightTemplateVO.id")
boolean removeFreightTemplate(String id); boolean removeFreightTemplate(String id);
} }