|
|
@ -67,6 +67,7 @@ import com.google.common.cache.CacheBuilder; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -562,7 +563,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
|
|
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
|
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) { |
|
|
|
if (null == formDTO.getIsPage()||formDTO.getIsPage()) { |
|
|
|
//分页
|
|
|
|
String finalStaffOrgPath = staffOrgPath; |
|
|
|
pageInfo= PageHelper.startPage(formDTO.getPageNo(), |
|
|
@ -746,21 +747,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
List<ResiUserQueryValueDTO> conditions, |
|
|
|
String currentStaffAgencyId, |
|
|
|
String staffOrgPath){ |
|
|
|
List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
|
|
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables, null, currentStaffAgencyId,staffOrgPath); |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
public List<String> getFinalSubables(String customerId, String formCode, String resultTableName, List<ResiUserQueryValueDTO> conditions) { |
|
|
|
CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); |
|
|
|
queryDTO.setCustomerId(customerId); |
|
|
|
queryDTO.setFormCode(formCode); |
|
|
|
//所有的子表
|
|
|
|
Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); |
|
|
|
/*List<String> subTablesBak=new ArrayList<>(); |
|
|
|
if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){ |
|
|
|
subTablesBak =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); |
|
|
|
}*/ |
|
|
|
|
|
|
|
List<SubTableJoinDTO> subTables =subTablesRes.getData(); |
|
|
|
// log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true));
|
|
|
|
//关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重
|
|
|
|
Set<String> whereConditionTables=conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); |
|
|
|
Set<String> tables=new HashSet<>(); |
|
|
|
tables.addAll(whereConditionTables); |
|
|
|
Set<String> tables = new HashSet<>(whereConditionTables); |
|
|
|
tables.add(resultTableName); |
|
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
|
//最终关联的子表对应的sql:
|
|
|
@ -770,8 +774,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables,currentStaffAgencyId,staffOrgPath); |
|
|
|
return finalSubTables; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -920,7 +923,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
public List<Map<String, Object>> getDataForExport(ExportResiUserItemDTO formItemMap, String baseTableName, IcResiUserPageFormDTO pageFormDTO, |
|
|
|
String currentStaffAgencyId, |
|
|
|
String staffOrgPath) { |
|
|
|
Page<Map<String, Object>> mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getPageFlag()).doSelectPage(() -> { |
|
|
|
Page<Map<String, Object>> mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getIsPage()).doSelectPage(() -> { |
|
|
|
this.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), baseTableName, pageFormDTO.getConditions(), currentStaffAgencyId, staffOrgPath); |
|
|
|
}); |
|
|
|
mapListPage.getResult().parallelStream().filter(Objects::nonNull).forEach(resiUser -> { |
|
|
@ -1653,4 +1656,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
return userList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> dynamicQuery(String customerId, String formCode, String resultTableName, List<IcCustomExportResultDTO.SqlColumn> showSqlColumns, List<ResiUserQueryValueDTO> conditions, String currentStaffAgencyId, String staffOrgPath) { |
|
|
|
List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables,showSqlColumns,currentStaffAgencyId,staffOrgPath); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|