Commit 0b1561af by zhiwj

修改分组策略bug

parent f3537f69
......@@ -31,6 +31,7 @@ import org.apache.logging.log4j.Logger;
import org.redisson.api.RKeys;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -47,6 +48,8 @@ import java.util.stream.Collectors;
public class StoreApiServiceImpl implements StoreApiService {
private static final Logger logger = LogManager.getLogger(StoreApiServiceImpl.class);
private static Map<Integer, BulkUpdateStoreStrtegy> storeStrtegyMap = new HashMap<>();
@Value("${storeExpiredTime}")
private Long storeExpiredTime;
@Autowired
private StoreService storeService;
@Autowired
......@@ -192,7 +195,7 @@ public class StoreApiServiceImpl implements StoreApiService {
* @return
*/
private String getGroup(StoreDTO storeDTO) {
if (Integer.valueOf(1) == storeStrategyApiService.getStoreGroupStrategyWeight(storeDTO.getEnterpriseId()).getResult() && storeDTO.getIsEditStoreGroup() == 1) {
if (storeDTO.getIsEditStoreGroup() == 1 || Integer.valueOf(0).equals(storeStrategyApiService.getStoreGroupStrategyWeight(storeDTO.getEnterpriseId()).getResult())) {
// 不启用分组策略
if (storeDTO.getStoreGroupId() == null) {
// 取 未分类 分组
......@@ -355,12 +358,13 @@ public class StoreApiServiceImpl implements StoreApiService {
return ServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), ErrorCode.NOTEXISTS.getMsg());
}
// todo 修改门店缓存时间
RedisUtil.setCache(key, storeDTO, 1L, TimeUnit.HOURS);
RedisUtil.setCache(key, storeDTO, storeExpiredTime, TimeUnit.HOURS);
}
return ServiceResponse.success(storeDTO);
}
private StoreDTO getStoreDTO(Integer enterpriseId, Integer storeId) {
@Override
public StoreDTO getStoreDTO(Integer enterpriseId, Integer storeId) {
StoreDTO store = storeService.getById(storeId);
if (store == null) {
return null;
......
dubbo.registry.file=gic-store-service
\ No newline at end of file
dubbo.registry.file=gic-store-service
# 门店详情过期时间 单位:小时
storeExpiredTime=1
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment