|
|
@ -29,6 +29,8 @@ import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.IcResiUserImportService; |
|
|
|
import com.google.common.cache.Cache; |
|
|
|
import com.google.common.cache.CacheBuilder; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
@ -59,6 +61,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
public static final ThreadLocal<Map<String, List<ErrorRow>>> errorRows = new ThreadLocal<>(); |
|
|
|
public static final ThreadLocal<Map<String, List<SkipedRow>>> skipedRows = new ThreadLocal<>(); |
|
|
|
|
|
|
|
/** |
|
|
|
* key: itemId |
|
|
|
* value: |
|
|
|
* key: option的中文 |
|
|
|
* value: options的英文key,也可能是数据id |
|
|
|
*/ |
|
|
|
Cache<String, Map<String, String>> itemIdAndOptionsCache = CacheBuilder.newBuilder().maximumSize(500).build(); |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
@ -212,6 +223,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} finally { |
|
|
|
skipedRows.remove(); |
|
|
|
errorRows.remove(); |
|
|
|
itemIdAndOptionsCache.invalidateAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -562,10 +574,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
String colValue = options.get(cellContent); |
|
|
|
columnWrapper.setColValue(colValue); |
|
|
|
} else { |
|
|
|
// remote类型
|
|
|
|
|
|
|
|
Map<String, String> options = listRemoteOptions(headerColumnWrapper, columnWrapper.getOptionSourceValue(), currUserAgencyId, "saveorupdate"); |
|
|
|
String colValue = options.get(cellContent); |
|
|
|
// remote类型。优先从缓存取
|
|
|
|
Map<String, String> optionsOfItem = itemIdAndOptionsCache.getIfPresent(columnWrapperEntry.getKey()); |
|
|
|
if (optionsOfItem == null || optionsOfItem.size() == 0) { |
|
|
|
optionsOfItem = listRemoteOptions(headerColumnWrapper, columnWrapper.getOptionSourceValue(), currUserAgencyId, "saveorupdate"); |
|
|
|
itemIdAndOptionsCache.put(columnWrapperEntry.getKey(), optionsOfItem); |
|
|
|
} |
|
|
|
String colValue = optionsOfItem.get(cellContent); |
|
|
|
columnWrapper.setColValue(colValue); |
|
|
|
} |
|
|
|
} else if ("checkbox".equals(columnWrapper.getItemType())) { |
|
|
|