|
|
@ -1,13 +1,17 @@ |
|
|
|
package com.epmet.service.indexcal.impl; |
|
|
|
|
|
|
|
import com.epmet.dao.screen.IndexCodeFieldReDao; |
|
|
|
import com.epmet.entity.screen.IndexCodeFieldReEntity; |
|
|
|
import com.epmet.redis.IndexCodeFieldReRedis; |
|
|
|
import com.epmet.service.indexcal.IndexCodeFieldReService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService { |
|
|
@ -21,7 +25,11 @@ public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService { |
|
|
|
public Map<String, String> getIndexCodeFieldReMap() { |
|
|
|
Map<String, String> indexCodeFiledReMap = indexCodeFieldReRedis.getIndexCodeFiledReMap(); |
|
|
|
if (CollectionUtils.isEmpty(indexCodeFiledReMap)) { |
|
|
|
indexCodeFiledReMap = indexCodeFieldReDao.getAllData(); |
|
|
|
List<IndexCodeFieldReEntity> allData = indexCodeFieldReDao.getAllData(); |
|
|
|
if (CollectionUtils.isEmpty(allData)){ |
|
|
|
return new HashMap<>(); |
|
|
|
} |
|
|
|
indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId())); |
|
|
|
indexCodeFieldReRedis.setIndexCodeFiledReMap(indexCodeFiledReMap); |
|
|
|
} |
|
|
|
return indexCodeFiledReMap; |
|
|
|