Browse Source

Merge branch 'dev_ic_diaodong' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_ic_diaodong

dev
wangxianzhang 4 years ago
parent
commit
5c2558f4d7
  1. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.28__fact_icuser_category_analysis_daily.sql
  2. 24
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemSelectFormDTO.java
  3. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java
  4. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java
  5. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java
  6. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java
  7. 1
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml
  8. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  9. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java
  10. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java
  11. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java
  12. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java
  13. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeDetailedServiceImpl.java
  14. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java
  15. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java
  16. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  17. 32
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml
  18. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeDetailedDao.xml
  19. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.28__fact_icuser_category_analysis_daily.sql

@ -0,0 +1,21 @@
CREATE TABLE `fact_icuser_category_analysis_daily` (
`ID` varchar(32) NOT NULL COMMENT '主键(人员类别分析表)',
`CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户id',
`CONFIG_ID` varchar(64) NOT NULL COMMENT '预警配置ID',
`COLUMN_NAME` varchar(32) NOT NULL COMMENT '列名',
`DATE_ID` varchar(8) NOT NULL COMMENT '当前数据是截止到XXX的:yyyyMMdd',
`ORG_ID` varchar(32) NOT NULL COMMENT '网格id或者组织id',
`ORG_TYPE` varchar(10) NOT NULL COMMENT 'grid或者agency',
`PID` varchar(32) NOT NULL COMMENT 'orgid的上级',
`PIDS` varchar(255) NOT NULL COMMENT 'orgid的所有上级',
`TOTAL` int(11) NOT NULL COMMENT '当前类别总人数',
`QR_INCR` int(11) NOT NULL COMMENT '较上月迁入',
`QC_INCR` int(11) NOT NULL COMMENT '较上月迁出',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='人员类别分析(目前只统计了网格)';

24
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemSelectFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form.demand;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
public class ServiceItemSelectFormDTO implements Serializable {
private static final long serialVersionUID = 1689002457565460495L;
public interface AddUserInternalGroup {
}
/**
* all:查询全部
* usable可用的
* 默认查询全部
*/
private String type;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java

@ -8,6 +8,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO; import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO; import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.ServiceItemSelectFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO; import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO; import com.epmet.dto.result.demand.ServiceItemResultDTO;
@ -79,7 +80,9 @@ public class IcServiceItemDictController {
* @return * @return
*/ */
@PostMapping("dict-list") @PostMapping("dict-list")
public Result<List<OptionDTO>> queryDictList(@LoginUser TokenDto tokenDto){ public Result<List<OptionDTO>> queryDictList(@LoginUser TokenDto tokenDto,@RequestBody ServiceItemSelectFormDTO formDTO){
return new Result<List<OptionDTO>>().ok(icServiceItemDictService.queryDictList(tokenDto.getCustomerId())); formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,ServiceItemSelectFormDTO.AddUserInternalGroup.class);
return new Result<List<OptionDTO>>().ok(icServiceItemDictService.queryDictListForSelect(formDTO));
} }
} }

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO; import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO; import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.ServiceItemSelectFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO; import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO; import com.epmet.dto.result.demand.ServiceItemResultDTO;
@ -62,4 +63,11 @@ public interface IcServiceItemDictService extends BaseService<IcServiceItemDictE
* @return * @return
*/ */
List<OptionDTO> queryDictList(String customerId); List<OptionDTO> queryDictList(String customerId);
/**
* 前端调用此接口
* @param formDTO
* @return
*/
List<OptionDTO> queryDictListForSelect(ServiceItemSelectFormDTO formDTO);
} }

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dao.IcServiceItemDictDao; import com.epmet.dao.IcServiceItemDictDao;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO; import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO; import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.ServiceItemSelectFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO; import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO; import com.epmet.dto.result.demand.ServiceItemResultDTO;
@ -146,5 +147,29 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl<IcServiceItemD
return resultList; return resultList;
} }
/**
* 前端调用此接口
*
* @param formDTO
* @return
*/
@Override
public List<OptionDTO> queryDictListForSelect(ServiceItemSelectFormDTO formDTO) {
List<OptionDTO> resultList = new ArrayList<>();
LambdaQueryWrapper<IcServiceItemDictEntity> query = new LambdaQueryWrapper<>();
query.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId())
.eq(StringUtils.isNotBlank(formDTO.getType()) && "usable".equals(formDTO.getType()), IcServiceItemDictEntity::getUsableFlag, true)
.orderByAsc(IcServiceItemDictEntity::getSort);
List<IcServiceItemDictEntity> list=baseDao.selectList(query);
for(IcServiceItemDictEntity entity:list){
OptionDTO optionDTO=new OptionDTO();
optionDTO.setLabel(entity.getCategoryName());
optionDTO.setValue(entity.getCategoryCode());
optionDTO.setAwardPoint(entity.getAwardPoint());
resultList.add(optionDTO);
}
return resultList;
}
} }

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java

@ -19,7 +19,6 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
@ -176,14 +175,15 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
throw new RenException("工作人员所属组织信息查询异常"); throw new RenException("工作人员所属组织信息查询异常");
} }
List<String> agencyIds = new ArrayList<>(); List<String> agencyIds = new ArrayList<>();
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { //2022.01.26与社会组织列表一直,查询当前工作人员所属组织建立的社会组织
/*if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) {
if (staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)) { if (staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)) {
agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON))); agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON)));
}else{ }else{
//当前用户属于第二级组织的人,不会有: //当前用户属于第二级组织的人,不会有:
agencyIds.add(staffInfoCacheResult.getAgencyPIds()); agencyIds.add(staffInfoCacheResult.getAgencyPIds());
} }
} }*/
agencyIds.add(staffInfoCacheResult.getAgencyId()); agencyIds.add(staffInfoCacheResult.getAgencyId());
resultList = baseDao.selectListByAgencyId(agencyIds, formDTO.getServiceName(), formDTO.getCustomerId(), formDTO.getQueryPurpose()); resultList = baseDao.selectListByAgencyId(agencyIds, formDTO.getServiceName(), formDTO.getCustomerId(), formDTO.getQueryPurpose());
return resultList; return resultList;

1
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml

@ -22,5 +22,6 @@
INNER JOIN ic_resi_category_warn_config wc ON (sc.COLUMN_NAME = wc.COLUMN_NAME AND wc.DEL_FLAG = '0' AND wc.CUSTOMER_ID = sc.CUSTOMER_ID) INNER JOIN ic_resi_category_warn_config wc ON (sc.COLUMN_NAME = wc.COLUMN_NAME AND wc.DEL_FLAG = '0' AND wc.CUSTOMER_ID = sc.CUSTOMER_ID)
WHERE cm.DEL_FLAG = 0 WHERE cm.DEL_FLAG = 0
AND cm.USER_ID = #{userId} AND cm.USER_ID = #{userId}
ORDER BY cm.sort
</select> </select>
</mapper> </mapper>

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java

@ -74,4 +74,6 @@ public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> {
*/ */
List<PersonWarnLeftPieDTO> selectCategoryCount(@Param("configIds") List<String> configIds,@Param("agencyId")String agencyId); List<PersonWarnLeftPieDTO> selectCategoryCount(@Param("configIds") List<String> configIds,@Param("agencyId")String agencyId);
List<Map<String,String>> selectCategoryCountByColumn(@Param("columnNames") List<String> columnNames,@Param("agencyId")String agencyId);
} }

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java

@ -22,6 +22,8 @@ import com.epmet.entity.IcUserChangeDetailedEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 变更明细表 * 变更明细表
[一条变更记录对应多条人员类别数据] [一条变更记录对应多条人员类别数据]
@ -36,5 +38,5 @@ public interface IcUserChangeDetailedDao extends BaseDao<IcUserChangeDetailedEnt
* @Author sun * @Author sun
* @Description 删除客户是新增类型的变更明细历史数据 * @Description 删除客户是新增类型的变更明细历史数据
**/ **/
void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type); void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type, @Param("icUserIds") List<String> icUserIds);
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java

@ -48,5 +48,5 @@ public interface IcUserChangeRecordDao extends BaseDao<IcUserChangeRecordEntity>
* @Author sun * @Author sun
* @Description 删除客户是新增类型的变更历史数据 * @Description 删除客户是新增类型的变更历史数据
**/ **/
void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type); void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type, @Param("icUserIds") List<String> icUserIds);
} }

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java

@ -19,6 +19,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.IcUserChangeDetailedEntity; import com.epmet.entity.IcUserChangeDetailedEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 变更明细表 * 变更明细表
@ -33,5 +36,5 @@ public interface IcUserChangeDetailedService extends BaseService<IcUserChangeDet
* @Author sun * @Author sun
* @Description 删除客户是新增类型的变更明细历史数据 * @Description 删除客户是新增类型的变更明细历史数据
**/ **/
void delByCustomerId(String customerId, String type); void delByCustomerId(String customerId, String type, List<String> icUserIds);
} }

30
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java

@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
@ -44,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -144,9 +142,27 @@ public class IcStatsResiWarnServiceImpl extends BaseServiceImpl<IcStatsResiWarnD
p.setConfigId(c.getWarnConfigId()); p.setConfigId(c.getWarnConfigId());
list.add(p); list.add(p);
}); });
List<PersonWarnLeftPieDTO> dtos = baseDao.selectCategoryCount(configList.stream().map(m -> m.getWarnConfigId()).collect(Collectors.toList()), staffInfo.getAgencyId()); // List<PersonWarnLeftPieDTO> dtos = baseDao.selectCategoryCount(configList.stream().map(m -> m.getWarnConfigId()).collect(Collectors.toList()), staffInfo.getAgencyId());
if (CollectionUtils.isNotEmpty(dtos)){ List<String> columns = configList.stream().map(m -> m.getColumnName()).collect(Collectors.toList());
list.forEach(l -> dtos.stream().filter(d -> d.getConfigId().equals(l.getConfigId())).forEach(d -> l.setTypeCount(d.getCount()))); List<Map<String, String>> maps = baseDao.selectCategoryCountByColumn(columns, staffInfo.getAgencyId());
// if (CollectionUtils.isNotEmpty(dtos)){
// list.forEach(l -> dtos.stream().filter(d -> d.getConfigId().equals(l.getConfigId())).forEach(d -> l.setTypeCount(d.getCount())));
// }
Map<String,Integer> columnCount = new HashMap<>(16);
if (CollectionUtils.isNotEmpty(maps)){
columns.forEach(c -> {
Map<String, List<Map<String, String>>> groupByColumn = maps.stream().collect(Collectors.groupingBy((Map<String, String> m) -> m.get(c)));
columnCount.put(c,CollectionUtils.isNotEmpty(groupByColumn.get(NumConstant.ONE_STR)) ? groupByColumn.get(NumConstant.ONE_STR).size() : NumConstant.ZERO);
});
}
if (!org.springframework.util.CollectionUtils.isEmpty(columnCount)){
list.forEach(l -> {
columnCount.forEach((k,v) -> {
if (l.getTypeCode().equals(k)){
l.setTypeCount(v);
}
});
});
} }
result.setTotal(list.stream().collect(Collectors.summingInt(PersonWarnLeftPieResultDTO.PersonWarnLeftPie::getTypeCount))); result.setTotal(list.stream().collect(Collectors.summingInt(PersonWarnLeftPieResultDTO.PersonWarnLeftPie::getTypeCount)));
result.setList(list); result.setList(list);

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeDetailedServiceImpl.java

@ -23,6 +23,8 @@ import com.epmet.entity.IcUserChangeDetailedEntity;
import com.epmet.service.IcUserChangeDetailedService; import com.epmet.service.IcUserChangeDetailedService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 变更明细表 * 变更明细表
[一条变更记录对应多条人员类别数据] [一条变更记录对应多条人员类别数据]
@ -38,7 +40,7 @@ public class IcUserChangeDetailedServiceImpl extends BaseServiceImpl<IcUserChang
* @Description 删除客户是新增类型的变更明细历史数据 * @Description 删除客户是新增类型的变更明细历史数据
**/ **/
@Override @Override
public void delByCustomerId(String customerId, String type) { public void delByCustomerId(String customerId, String type, List<String> icUserIds) {
baseDao.delByCustomerId(customerId, type); baseDao.delByCustomerId(customerId, type, icUserIds);
} }
} }

15
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java

@ -44,6 +44,7 @@ import com.epmet.service.IcUserChangeRecordService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -206,7 +207,7 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
detailed.setBuildingId(map.get("BUILD_ID")); detailed.setBuildingId(map.get("BUILD_ID"));
detailed.setBuildingUnitId(map.get("UNIT_ID")); detailed.setBuildingUnitId(map.get("UNIT_ID"));
detailed.setHouseId(map.get("HOME_ID")); detailed.setHouseId(map.get("HOME_ID"));
detailed.setIcUserId(map.get("HOME_ID")); detailed.setIcUserId(map.get("ID"));
detailed.setType("add"); detailed.setType("add");
detailed.setTypeName("新增"); detailed.setTypeName("新增");
detailed.setFieldName(dto.getColumnName()); detailed.setFieldName(dto.getColumnName());
@ -246,9 +247,17 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
} }
} while (icUserList.size() == NumConstant.ONE_THOUSAND); } while (icUserList.size() == NumConstant.ONE_THOUSAND);
//4.批量新增数据,先删后增【只删除新增节点的历史数据】 //4.批量新增数据,先删后增【只删除新增节点的历史数据】
baseDao.delByCustomerId(customerId, "add"); //4-1.删除待处理的人员数据【这类人是指在变更记录表中不存在新增节点数据的人】
icUserChangeDetailedService.delByCustomerId(customerId, "add"); List<String> icUserIdList = changeList.stream().map(IcUserChangeRecordEntity::getIcUserId).collect(Collectors.toList());
List<List<String>> partition = ListUtils.partition(icUserIdList, NumConstant.FIVE_HUNDRED);
partition.forEach(part -> {
baseDao.delByCustomerId(customerId, "add", part);
icUserChangeDetailedService.delByCustomerId(customerId, "add", part);
});
log.info("初始变更记录数据,总条数->" + changeList.size());
icUserChangeRecordService.insertBatch(changeList); icUserChangeRecordService.insertBatch(changeList);
log.info("初始变更记录明细数据,总条数->" + detailedList.size());
icUserChangeDetailedService.insertBatch(detailedList); icUserChangeDetailedService.insertBatch(detailedList);
} }

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java

@ -41,6 +41,7 @@ import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcUserChangeDetailedService; import com.epmet.service.IcUserChangeDetailedService;
import com.epmet.service.IcUserChangeRecordService; import com.epmet.service.IcUserChangeRecordService;
import com.epmet.service.IcUserTransferRecordService; import com.epmet.service.IcUserTransferRecordService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -161,13 +162,13 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
.append(result1.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result1.getData().getBuildingDTO().getBuildingName()).append("-") .append(result1.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result1.getData().getBuildingDTO().getBuildingName()).append("-")
.append(result1.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result1.getData().getHouseDTO().getHouseName()); .append(result1.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result1.getData().getHouseDTO().getHouseName());
changeRecordEntity.setBeforeChangeName(beforeName.toString()); changeRecordEntity.setBeforeChangeName(beforeName.toString());
StringBuffer afterName = new StringBuffer("-"); StringBuffer afterName = new StringBuffer();
if ("in".equals(formDTO.getType())) { if ("in".equals(formDTO.getType())) {
afterName.append(result2.getData().getAgencyDTO().getOrganizationName()).append("-").append(result2.getData().getGridDTO().getGridName()).append("-") afterName.append(result2.getData().getAgencyDTO().getOrganizationName()).append("-").append(result2.getData().getGridDTO().getGridName()).append("-")
.append(result2.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result2.getData().getBuildingDTO().getBuildingName()).append("-") .append(result2.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result2.getData().getBuildingDTO().getBuildingName()).append("-")
.append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName()); .append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName());
} }
changeRecordEntity.setAfterChangeName(afterName.toString()); changeRecordEntity.setAfterChangeName(StringUtils.isEmpty(afterName.toString()) ? "-" : afterName.toString());
changeRecordEntity.setChangeTime(formDTO.getTransferTime()); changeRecordEntity.setChangeTime(formDTO.getTransferTime());
changeRecordEntity.setRemark(formDTO.getRemark()); changeRecordEntity.setRemark(formDTO.getRemark());
icUserChangeRecordService.insert(changeRecordEntity); icUserChangeRecordService.insert(changeRecordEntity);

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -554,6 +554,7 @@
</foreach> </foreach>
FROM ic_resi_user FROM ic_resi_user
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND STATUS = '0'
AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%') AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
AND( AND(
<foreach collection="types" item="t" separator="OR"> <foreach collection="types" item="t" separator="OR">
@ -611,7 +612,7 @@
FROM FROM
ic_resi_user iru ic_resi_user iru
<!-- 只查询在变更记录表不存在新增节点的居民 --> <!-- 只查询在变更记录表不存在新增节点的居民 -->
LEFT JOIN ic_user_change_record iucr ON iru.id = iucr.ic_user_id AND iucr.type = 'add' LEFT JOIN ic_user_change_record iucr ON iru.id = iucr.ic_user_id AND iucr.type = 'add' AND iucr.del_flag = '0'
WHERE WHERE
iucr.ic_user_id IS NULL iucr.ic_user_id IS NULL
AND iru.del_flag = '0' AND iru.del_flag = '0'

32
epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

@ -61,6 +61,7 @@
select count(*) select count(*)
from ic_resi_user from ic_resi_user
where 1=1 where 1=1
AND STATUS = '0'
<if test="tableName=='ic_resi_user'"> <if test="tableName=='ic_resi_user'">
and ${columnName} = '1' and ${columnName} = '1'
</if> </if>
@ -96,6 +97,7 @@
count(*) as count count(*) as count
from ic_resi_user from ic_resi_user
where 1=1 where 1=1
AND status = '0'
<if test="tableName=='ic_resi_user'"> <if test="tableName=='ic_resi_user'">
and ${columnName} = '1' and ${columnName} = '1'
</if> </if>
@ -150,26 +152,36 @@
<select id="userWarnListDTO" resultType="com.epmet.dto.result.UserWarnNameListResultDTO"> <select id="userWarnListDTO" resultType="com.epmet.dto.result.UserWarnNameListResultDTO">
select select
BUILD_ID as buildingId, BUILD_ID as buildingId,
name as residentName, name as residentName,
ID AS userId ID AS userId
from ic_resi_user from ic_resi_user
where where DEL_FLAG = '0'
BUILD_ID in and CUSTOMER_ID = #{customerId}
<foreach collection="buildingIdList" item="buildingId" open="(" separator="," close=" )">
#{buildingId}
</foreach>
<if test="tableName=='ic_resi_user'"> <if test="tableName=='ic_resi_user'">
and ${columnName} = '1' and ${columnName} = '1'
</if> </if>
AND BUILD_ID in
<foreach collection="buildingIdList" item="buildingId" open="(" separator="," close=" )">
#{buildingId}
</foreach>
<if test="tableName!='ic_resi_user'"> <if test="tableName!='ic_resi_user'">
and ID in ( and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
) )
</if> </if>
and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0'
group by ID group by ID
</select> </select>
<select id="selectCategoryCountByColumn" resultType="java.util.Map">
SELECT
<foreach collection="columnNames" item="t" separator=",">
IFNULL(${t},'0') AS #{t}
</foreach>
FROM ic_resi_user
WHERE DEL_FLAG = 0
AND `STATUS` = '0'
AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{agencyId},'%')
</select>
</mapper> </mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeDetailedDao.xml

@ -10,6 +10,9 @@
WHERE WHERE
CUSTOMER_ID = #{customerId} CUSTOMER_ID = #{customerId}
AND type = #{type} AND type = #{type}
<foreach collection="icUserIds" item="icUserId" open="AND ic_user_id IN (" separator="," close=")">
#{icUserId}
</foreach>
</delete> </delete>
</mapper> </mapper>

5
epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml

@ -64,8 +64,11 @@
FROM FROM
ic_user_change_record ic_user_change_record
WHERE WHERE
CUSTOMER_ID = #{customerId} customer_id = #{customerId}
AND type = #{type} AND type = #{type}
<foreach collection="icUserIds" item="icUserId" open="AND ic_user_id IN (" separator="," close=")">
#{icUserId}
</foreach>
</delete> </delete>
</mapper> </mapper>
Loading…
Cancel
Save