Commit 3d40d45a by 黄超华

Merge remote-tracking branch 'origin/master'

2 parents 3b12f221 8376fe25
...@@ -19,6 +19,8 @@ public interface BaseCategoryConverter { ...@@ -19,6 +19,8 @@ public interface BaseCategoryConverter {
QueryThreeCategoryListResponse toThreeCategoryListResponse(BaseCategory entity); QueryThreeCategoryListResponse toThreeCategoryListResponse(BaseCategory entity);
BaseCategory responseToBaseCategory(QueryCategoryListResponse entity); QueryCategoryListResponse toCategoryListResponse(BaseCategory entity);
BaseCategory toBaseCategory(QueryCategoryListResponse entity);
} }
...@@ -26,6 +26,8 @@ public interface BaseDistrictConverter { ...@@ -26,6 +26,8 @@ public interface BaseDistrictConverter {
QueryAddressStreetResponse toAddressStreetResponse(BaseDistrict entity); QueryAddressStreetResponse toAddressStreetResponse(BaseDistrict entity);
BaseDistrict responseToBaseDistrict(QueryAddressListResponse entity); QueryAddressListResponse toAddressListResponse(BaseDistrict entity);
BaseDistrict toBaseDistrict(QueryAddressListResponse entity);
} }
...@@ -23,7 +23,7 @@ public class BaseBrandService { ...@@ -23,7 +23,7 @@ public class BaseBrandService {
@Autowired @Autowired
private CloudCraneService cloudCraneService; private CloudCraneService cloudCraneService;
@Cacheable(value = "brandList") //@Cacheable(value = "brandList")
public List<QueryBrandListResponse> queryBrandList() { public List<QueryBrandListResponse> queryBrandList() {
List<BaseBrand> brandList = baseBrandMapper.selectList(); List<BaseBrand> brandList = baseBrandMapper.selectList();
List<QueryBrandListResponse> list = brandList.parallelStream() List<QueryBrandListResponse> list = brandList.parallelStream()
......
...@@ -10,7 +10,6 @@ import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryThreeCategoryLis ...@@ -10,7 +10,6 @@ import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryThreeCategoryLis
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -26,7 +25,7 @@ public class BaseCategoryService { ...@@ -26,7 +25,7 @@ public class BaseCategoryService {
@Autowired @Autowired
private CloudCraneService cloudCraneService; private CloudCraneService cloudCraneService;
@Cacheable(value = "oneCategoryList") //@Cacheable(value = "oneCategoryList")
public List<QueryOneCategoryListResponse> queryOneCategoryList() { public List<QueryOneCategoryListResponse> queryOneCategoryList() {
List<BaseCategory> oneCategoryList = baseCategoryMapper.selectByCategoryLevel(1); List<BaseCategory> oneCategoryList = baseCategoryMapper.selectByCategoryLevel(1);
List<QueryOneCategoryListResponse> list = oneCategoryList.parallelStream() List<QueryOneCategoryListResponse> list = oneCategoryList.parallelStream()
...@@ -38,7 +37,7 @@ public class BaseCategoryService { ...@@ -38,7 +37,7 @@ public class BaseCategoryService {
return cloudCraneService.queryOneCategoryList(); return cloudCraneService.queryOneCategoryList();
} }
@Cacheable(value = "secondCategoryList", key = "#parentCategoryCode") //@Cacheable(value = "secondCategoryList", key = "#parentCategoryCode")
public List<QuerySecondCategoryListResponse> querySecondCategoryList(String parentCategoryCode) { public List<QuerySecondCategoryListResponse> querySecondCategoryList(String parentCategoryCode) {
List<BaseCategory> twoCategoryList = baseCategoryMapper.selectByParentCategoryCode(parentCategoryCode); List<BaseCategory> twoCategoryList = baseCategoryMapper.selectByParentCategoryCode(parentCategoryCode);
List<QuerySecondCategoryListResponse> list = twoCategoryList.parallelStream() List<QuerySecondCategoryListResponse> list = twoCategoryList.parallelStream()
...@@ -50,7 +49,7 @@ public class BaseCategoryService { ...@@ -50,7 +49,7 @@ public class BaseCategoryService {
return cloudCraneService.querySecondCategoryList(parentCategoryCode); return cloudCraneService.querySecondCategoryList(parentCategoryCode);
} }
@Cacheable(value = "threeCategoryList", key = "#parentCategoryCode") //@Cacheable(value = "threeCategoryList", key = "#parentCategoryCode")
public List<QueryThreeCategoryListResponse> queryThreeCategoryList(String parentCategoryCode) { public List<QueryThreeCategoryListResponse> queryThreeCategoryList(String parentCategoryCode) {
List<BaseCategory> threeCategoryList = baseCategoryMapper.selectByParentCategoryCode(parentCategoryCode); List<BaseCategory> threeCategoryList = baseCategoryMapper.selectByParentCategoryCode(parentCategoryCode);
List<QueryThreeCategoryListResponse> list = threeCategoryList.parallelStream() List<QueryThreeCategoryListResponse> list = threeCategoryList.parallelStream()
...@@ -63,7 +62,13 @@ public class BaseCategoryService { ...@@ -63,7 +62,13 @@ public class BaseCategoryService {
} }
public List<QueryCategoryListResponse> queryCategoryList() { public List<QueryCategoryListResponse> queryCategoryList() {
List<BaseCategory> list = baseCategoryMapper.selectList(); List<BaseCategory> allCategoryList = baseCategoryMapper.selectList();
List<QueryCategoryListResponse> list = allCategoryList.parallelStream()
.map(BaseCategoryConverter.INSTANCE::toCategoryListResponse).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
return list;
}
return cloudCraneService.queryCategoryList(); return cloudCraneService.queryCategoryList();
} }
...@@ -74,7 +79,7 @@ public class BaseCategoryService { ...@@ -74,7 +79,7 @@ public class BaseCategoryService {
if (CollectionUtils.isEmpty(categoryList)) { if (CollectionUtils.isEmpty(categoryList)) {
return 0; return 0;
} }
List<BaseCategory> list = categoryList.parallelStream().map(BaseCategoryConverter.INSTANCE::responseToBaseCategory).collect(Collectors.toList()); List<BaseCategory> list = categoryList.parallelStream().map(BaseCategoryConverter.INSTANCE::toBaseCategory).collect(Collectors.toList());
return baseCategoryMapper.batchInsertOrUpdate(list); return baseCategoryMapper.batchInsertOrUpdate(list);
} }
......
...@@ -10,7 +10,6 @@ import com.google.common.collect.Lists; ...@@ -10,7 +10,6 @@ import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -49,7 +48,7 @@ public class BaseDistrictService { ...@@ -49,7 +48,7 @@ public class BaseDistrictService {
} }
} }
@Cacheable(value = "addressProvinces") //@Cacheable(value = "addressProvinces")
public List<QueryAddressProvinceResponse> queryAddressProvince() { public List<QueryAddressProvinceResponse> queryAddressProvince() {
List<BaseDistrict> addressProvinceList = baseDistrictMapper.selectByAddressLevel(1001); List<BaseDistrict> addressProvinceList = baseDistrictMapper.selectByAddressLevel(1001);
...@@ -62,7 +61,7 @@ public class BaseDistrictService { ...@@ -62,7 +61,7 @@ public class BaseDistrictService {
return cloudCraneService.queryAddressProvince(); return cloudCraneService.queryAddressProvince();
} }
@Cacheable(value = "addressCities", key = "#parentAddressCode") //@Cacheable(value = "addressCities", key = "#parentAddressCode")
public List<QueryAddressCityResponse> queryAddressCity(String parentAddressCode) { public List<QueryAddressCityResponse> queryAddressCity(String parentAddressCode) {
List<BaseDistrict> addressCityList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode); List<BaseDistrict> addressCityList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode);
List<QueryAddressCityResponse> list = addressCityList.parallelStream() List<QueryAddressCityResponse> list = addressCityList.parallelStream()
...@@ -74,7 +73,7 @@ public class BaseDistrictService { ...@@ -74,7 +73,7 @@ public class BaseDistrictService {
return cloudCraneService.queryAddressCity(parentAddressCode); return cloudCraneService.queryAddressCity(parentAddressCode);
} }
@Cacheable(value = "addressAreas", key = "#parentAddressCode") //@Cacheable(value = "addressAreas", key = "#parentAddressCode")
public List<QueryAddressAreaResponse> queryAddressArea(String parentAddressCode) { public List<QueryAddressAreaResponse> queryAddressArea(String parentAddressCode) {
List<BaseDistrict> addressAreaList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode); List<BaseDistrict> addressAreaList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode);
List<QueryAddressAreaResponse> list = addressAreaList.parallelStream() List<QueryAddressAreaResponse> list = addressAreaList.parallelStream()
...@@ -86,7 +85,7 @@ public class BaseDistrictService { ...@@ -86,7 +85,7 @@ public class BaseDistrictService {
return cloudCraneService.queryAddressArea(parentAddressCode); return cloudCraneService.queryAddressArea(parentAddressCode);
} }
@Cacheable(value = "addressStreets", key = "#parentAddressCode") //@Cacheable(value = "addressStreets", key = "#parentAddressCode")
public List<QueryAddressStreetResponse> queryAddressStreet(String parentAddressCode) { public List<QueryAddressStreetResponse> queryAddressStreet(String parentAddressCode) {
List<BaseDistrict> addressStreetList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode); List<BaseDistrict> addressStreetList = baseDistrictMapper.selectByParentAddressCode(parentAddressCode);
List<QueryAddressStreetResponse> list = addressStreetList.parallelStream() List<QueryAddressStreetResponse> list = addressStreetList.parallelStream()
...@@ -99,7 +98,13 @@ public class BaseDistrictService { ...@@ -99,7 +98,13 @@ public class BaseDistrictService {
} }
public List<QueryAddressListResponse> queryAddressList() { public List<QueryAddressListResponse> queryAddressList() {
List<BaseDistrict> list = baseDistrictMapper.selectList(); List<BaseDistrict> allAddressList = baseDistrictMapper.selectList();
List<QueryAddressListResponse> list = allAddressList.parallelStream()
.map(BaseDistrictConverter.INSTANCE::toAddressListResponse).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
return list;
}
return cloudCraneService.queryAddressList(); return cloudCraneService.queryAddressList();
} }
...@@ -110,7 +115,7 @@ public class BaseDistrictService { ...@@ -110,7 +115,7 @@ public class BaseDistrictService {
if (CollectionUtils.isEmpty(addressList)) { if (CollectionUtils.isEmpty(addressList)) {
return 0; return 0;
} }
List<BaseDistrict> list = addressList.parallelStream().map(BaseDistrictConverter.INSTANCE::responseToBaseDistrict).collect(Collectors.toList()); List<BaseDistrict> list = addressList.parallelStream().map(BaseDistrictConverter.INSTANCE::toBaseDistrict).collect(Collectors.toList());
return baseDistrictMapper.batchInsertOrUpdate(list); return baseDistrictMapper.batchInsertOrUpdate(list);
} }
......
...@@ -23,7 +23,7 @@ public class BaseExpressService { ...@@ -23,7 +23,7 @@ public class BaseExpressService {
@Autowired @Autowired
private CloudCraneService cloudCraneService; private CloudCraneService cloudCraneService;
@Cacheable(value = "expressList") //@Cacheable(value = "expressList")
public List<QueryExpressListResponse> queryExpressList() { public List<QueryExpressListResponse> queryExpressList() {
List<BaseExpress> expressList = baseExpressMapper.selectList(); List<BaseExpress> expressList = baseExpressMapper.selectList();
List<QueryExpressListResponse> list = expressList.parallelStream() List<QueryExpressListResponse> list = expressList.parallelStream()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!