|
|
@ -20,11 +20,9 @@ package com.epmet.service.impl; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.epmet.bean.ResiExportBaseInfoData; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.constant.*; |
|
|
|
import com.epmet.commons.tools.dto.form.DictListFormDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.DictListResultDTO; |
|
|
@ -69,6 +67,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@ -77,6 +76,8 @@ import java.math.RoundingMode; |
|
|
|
import java.sql.Date; |
|
|
|
import java.sql.Timestamp; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -114,6 +115,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
private IcUserChangeDetailedService icUserChangeDetailedService; |
|
|
|
@Autowired |
|
|
|
private IcUserTransferRecordService icUserTransferRecordService; |
|
|
|
@Autowired |
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
@ -881,7 +884,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
Page<Map<String, Object>> mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getPageFlag()).doSelectPage(() -> { |
|
|
|
this.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), baseTableName, pageFormDTO.getConditions(), currentStaffAgencyId, staffOrgPath); |
|
|
|
}); |
|
|
|
mapListPage.getResult().stream().filter(Objects::nonNull).forEach(resiUser -> { |
|
|
|
mapListPage.getResult().parallelStream().filter(Objects::nonNull).forEach(resiUser -> { |
|
|
|
String resiId = null; |
|
|
|
//获取用户Id
|
|
|
|
if (IcResiUserConstant.IC_RESI_USER.equals(baseTableName)) { |
|
|
@ -905,28 +908,33 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
}); |
|
|
|
|
|
|
|
//当前条数据原始的id值 resiUser
|
|
|
|
Map<String,Object> originalConditionMap = new HashMap<>(); |
|
|
|
for (FormItemResult e : formItemMap.getItemMap().values()) { |
|
|
|
Map<String,Object> originalConditionMap = new ConcurrentHashMap<>(); |
|
|
|
formItemMap.getItemMap().values().parallelStream().forEach(e->{ |
|
|
|
String columnName = getColumnName(e); |
|
|
|
Object temp = resiUser.get(columnName); |
|
|
|
String vauleStr = temp == null ? StrConstant.EPMETY_STR : temp.toString(); |
|
|
|
originalConditionMap.putIfAbsent(columnName,vauleStr); |
|
|
|
if ("remote".equals(e.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { |
|
|
|
if (Constant.OPITON_SOURCE_REMOTE.equals(e.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { |
|
|
|
putRemoteValue(formItemMap.getRemoteItemConditionMap().get(e.getItemId()), currentStaffAgencyId, resiUser,originalConditionMap, e, columnName, vauleStr); |
|
|
|
} else { |
|
|
|
putOptionValue(resiUser, e, columnName, vauleStr); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (IcResiUserConstant.IC_RESI_USER.equals(baseTableName)) { |
|
|
|
//把人放入redis缓存 便于后面的sheet使用基础信息
|
|
|
|
ResiExportBaseInfoData infoData = ConvertUtils.mapToEntity(resiUser, ResiExportBaseInfoData.class); |
|
|
|
redisTemplate.opsForValue().set(RedisKeys.getExportResiBaseInfoKey(resiId), infoData,RedisUtils.MINUTE_THIRTY_EXPIRE, TimeUnit.SECONDS); |
|
|
|
} else { |
|
|
|
ResiExportBaseInfoData temp = (ResiExportBaseInfoData) redisTemplate.opsForValue().get(RedisKeys.getExportResiBaseInfoKey(resiId)); |
|
|
|
if (temp != null){ |
|
|
|
try { |
|
|
|
resiUser.putAll(ConvertUtils.entityToMap(temp)); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("entityToMap exception,temp:{}",temp); |
|
|
|
} |
|
|
|
if (!IcResiUserConstant.IC_RESI_USER.equals(baseTableName)) { |
|
|
|
Map<String,Object> o = redisUtils.hGetAll(RedisKeys.getExportResiBaseInfoKey(resiId)); |
|
|
|
if (o != null){ |
|
|
|
resiUser.putAll(o); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//把人放入redis缓存 便于后面的sheet使用基础信息
|
|
|
|
redisUtils.hMSet(RedisKeys.getExportResiBaseInfoKey(resiId),resiUser,RedisUtils.MINUTE_THIRTY_EXPIRE); |
|
|
|
}); |
|
|
|
remoteOptionCacheMap.clear(); |
|
|
|
return mapListPage.getResult(); |
|
|
@ -966,7 +974,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
Map<String, String> remoteOptions = icResiUserImportService.listRemoteOptions(parts[0], parts[1], columnWrappers, currentStaffAgencyId, "query"); |
|
|
|
if (FormItemTypeEnum.CHECKBOX.getCode().equals(e.getItemType())) { |
|
|
|
remoteOptions.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? "是" : "否")); |
|
|
|
remoteOptions.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? StrConstant.YES : StrConstant.NO)); |
|
|
|
} else if (FormItemTypeEnum.SELECT.getCode().equals(e.getItemType())) { |
|
|
|
remoteOptions.forEach((label, value) -> { |
|
|
|
if (vauleStr.equals(value)) { |
|
|
@ -986,7 +994,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
switch (itemTypeEnum) { |
|
|
|
case CHECKBOX: |
|
|
|
e.getOptions().forEach(optionDTO -> { |
|
|
|
map.put(optionDTO.getValue(), vauleStr.contains(optionDTO.getValue()) ? "是" : "否"); |
|
|
|
map.put(optionDTO.getValue(), vauleStr.contains(optionDTO.getValue()) ? StrConstant.YES : StrConstant.NO); |
|
|
|
}); |
|
|
|
break; |
|
|
|
case SELECT: |
|
|
|