Skip to content

Commit

Permalink
优化一些配置项,优化部分路基
Browse files Browse the repository at this point in the history
  • Loading branch information
chopper711 committed Jan 11, 2022
1 parent 0460e21 commit 05818ba
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
6 changes: 3 additions & 3 deletions buyer-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
username: root
password: lilishop
maxActive: 20
initialSize: 5
maxActive: 50
initialSize: 10
maxWait: 60000
minIdle: 5
minIdle: 10
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
Expand Down
4 changes: 2 additions & 2 deletions config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
username: root
password: lilishop
maxActive: 20
initialSize: 5
maxActive: 50
initialSize: 20
maxWait: 60000
minIdle: 5
timeBetweenEvictionRunsMillis: 60000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
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.io.Serializable;
import java.util.List;

/**
Expand All @@ -13,6 +17,7 @@
* @author pikachu
* @since 2020-03-02 16:44:56
*/
@CacheConfig(cacheNames = "{category}")
public interface CategoryService extends IService<Category> {


Expand All @@ -25,6 +30,15 @@ public interface CategoryService extends IService<Category> {
*/
List<Category> dbList(String parentId);

/**
* 获取分类
*
* @param id
* @return
*/
@Cacheable(key = "#id")
Category getCategoryById(String id);

/**
* 根据分类id集合获取所有分类根据层级排序
*
Expand Down Expand Up @@ -86,6 +100,7 @@ public interface CategoryService extends IService<Category> {
* @param category 商品分类信息
* @return 修改结果
*/
@CacheEvict(key = "#category.id")
void updateCategory(Category category);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public List<Category> dbList(String parentId) {
return this.list(new LambdaQueryWrapper<Category>().eq(Category::getParentId, parentId));
}

@Override
public Category getCategoryById(String id) {
return this.getById(id);
}

/**
* 根据分类id集合获取所有分类根据层级排序
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ private void renderCartBySteps(TradeDTO tradeDTO, RenderStepEnums[] defaultRende
for (CartRenderStep render : cartRenderSteps) {
try {
if (render.step().equals(step)) {
Date date = new Date();
render.render(tradeDTO);
log.error(render.getClass().getName() + "-" + (System.currentTimeMillis() - date.getTime()));
}
} catch (ServiceException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void buildCartPrice(TradeDTO tradeDTO) {
String categoryId = cartSkuVO.getGoodsSku().getCategoryPath()
.substring(cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1);
if (CharSequenceUtil.isNotEmpty(categoryId)) {
Double commissionRate = categoryService.getById(categoryId).getCommissionRate();
Double commissionRate = categoryService.getCategoryById(categoryId).getCommissionRate();
priceDetailDTO.setPlatFormCommissionPoint(commissionRate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
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;

Expand All @@ -14,6 +17,7 @@
* @author Bulbasaur
* @since 2020-03-07 09:24:33
*/
@CacheConfig(cacheNames = "{freightTemplate}")
public interface FreightTemplateService extends IService<FreightTemplate> {

/**
Expand All @@ -38,6 +42,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param id 运费模板ID
* @return 运费模板
*/
@Cacheable(key = "#id")
FreightTemplateVO getFreightTemplate(String id);

/**
Expand All @@ -55,6 +60,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param freightTemplateVO 运费模板
* @return 运费模板
*/
@CacheEvict(key = "#freightTemplateVO.id")
FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO);

/**
Expand All @@ -64,6 +70,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param id 运费模板ID
* @return 操作状态
*/
@CacheEvict(key = "#freightTemplateVO.id")
boolean removeFreightTemplate(String id);

}

0 comments on commit 05818ba

Please sign in to comment.