@ -18,7 +18,6 @@
package com.epmet.service.impl ;
import cn.hutool.core.bean.BeanUtil ;
import com.alibaba.fastjson.JSON ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl ;
@ -382,12 +381,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
icUserTransferRecordService . add ( formDTO ) ;
}
//2.判断类别数据是否修改[类别修改的变更明细里边存修改后的新值,是就存1否就存-1]
Result < List < IcResiCategoryWarnConfigDTO > > resultList = operCustomizeOpenFeignClient . categoryWarnConfigList ( tokenDto . getCustomerId ( ) ) ;
if ( ! resultList . success ( ) ) {
throw new RuntimeException ( "居民信息修改,获取客户居民类别预警配置表数据失败" ) ;
IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO ( ) ;
sfdto . setCustomerId ( tokenDto . getCustomerId ( ) ) ;
Result < List < IcResiCategoryStatsConfigDTO > > categoryListResult = operCustomizeOpenFeignClient . getCategoryList ( sfdto ) ;
if ( ! categoryListResult . success ( ) ) {
throw new RenException ( "居民信息修改,获取客户居民类别预警配置表数据失败" ) ;
}
//修改前数据库居民十八类信息值
Map < String , String > hash = icResiUserDao . getCategoryListMap ( entity . getId ( ) ) ;
List < String > columns = categoryListResult . getData ( ) . stream ( ) . map ( IcResiCategoryStatsConfigDTO : : getColumnName ) . collect ( Collectors . toList ( ) ) ;
Map < String , String > hash = icResiUserDao . getCategoryListMap ( columns , entity . getId ( ) ) ;
//封装变更记录和变更明细数据
//变更记录
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity ( ) ;
@ -396,7 +398,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//变更明细
List < IcUserChangeDetailedEntity > list = new ArrayList < > ( ) ;
IcUserChangeDetailedEntity categoryEntity = null ;
for ( IcResiCategoryWarn ConfigDTO dto : resultLis t . getData ( ) ) {
for ( IcResiCategoryStats ConfigDTO dto : catego ryListR esult. getData ( ) ) {
String oldValue = hash . get ( dto . getColumnName ( ) ) ;
if ( map . containsKey ( dto . getColumnName ( ) ) & & ! oldValue . equals ( map . get ( dto . getColumnName ( ) ) ) ) {
//类别修改后的值
@ -707,11 +709,27 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
queryDTO . setFormCode ( formCode ) ;
//所有的子表
Result < List < SubTableJoinDTO > > subTablesRes = operCustomizeOpenFeignClient . querySubTables ( queryDTO ) ;
List < String > subTables = new ArrayList < > ( ) ;
/ * List < String > subTablesBak = new ArrayList < > ( ) ;
if ( subTablesRes . success ( ) & & CollectionUtils . isNotEmpty ( subTablesRes . getData ( ) ) ) {
subTables = subTablesRes . getData ( ) . stream ( ) . map ( SubTableJoinDTO : : getJoinTableSql ) . collect ( Collectors . toList ( ) ) ;
}
return baseDao . dynamicQuery ( customerId , resultTableName , conditions , subTables , currentStaffAgencyId , staffOrgPath ) ;
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 ) ;
tables . add ( resultTableName ) ;
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
//最终关联的子表对应的sql:
List < String > finalSubTables = new ArrayList < > ( ) ;
subTables . forEach ( subTable - > {
if ( tables . contains ( subTable . getTableName ( ) ) ) {
finalSubTables . add ( subTable . getJoinTableSql ( ) ) ;
}
} ) ;
return baseDao . dynamicQuery ( customerId , resultTableName , conditions , finalSubTables , currentStaffAgencyId , staffOrgPath ) ;
}
/ * *