Browse Source

Merge branch 'dev_grid_lively_syc' into dev

dev
sunyuchao 4 years ago
parent
commit
f50aa552b9
  1. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  2. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml
  3. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  4. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  5. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java
  6. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java
  7. 47
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

4
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -1155,8 +1155,8 @@
FROM FROM
fact_grid_member_statistics_daily fact_grid_member_statistics_daily
WHERE del_flag = '0' WHERE del_flag = '0'
AND DATE_FORMAT(created_time,'%Y%m%d') <![CDATA[ >= ]]> #{startTime} AND date_id <![CDATA[ >= ]]> #{startTime}
AND DATE_FORMAT(created_time,'%Y%m%d') <![CDATA[ <= ]]> #{endTime} AND date_id <![CDATA[ <= ]]> #{endTime}
AND project_incr > 0 AND project_incr > 0
AND pids LIKE CONCAT('%', #{agencyId}, '%') AND pids LIKE CONCAT('%', #{agencyId}, '%')
GROUP BY grid_id, date_id GROUP BY grid_id, date_id

4
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml

@ -150,8 +150,8 @@
stats_staff_patrol_record_daily stats_staff_patrol_record_daily
WHERE WHERE
del_flag = '0' del_flag = '0'
AND DATE_FORMAT(created_time,'%Y%m%d') <![CDATA[ >= ]]> #{startTime} AND date_id <![CDATA[ >= ]]> #{startTime}
AND DATE_FORMAT(created_time,'%Y%m%d') <![CDATA[ <= ]]> #{endTime} AND date_id <![CDATA[ <= ]]> #{endTime}
AND routine_work_count > 0 AND routine_work_count > 0
AND grid_pids LIKE CONCAT('%', #{agencyId}, '%') AND grid_pids LIKE CONCAT('%', #{agencyId}, '%')
GROUP BY grid_id, date_id GROUP BY grid_id, date_id

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

@ -230,7 +230,7 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds); List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
Map<String, String> getCategoryListMap(@Param("icUserId") String icUserId); Map<String, String> getCategoryListMap(@Param("columns")List<String> columns, @Param("icUserId") String icUserId);
Map<String, String> selectResiInfoMap(@Param("idCard") String idCard); Map<String, String> selectResiInfoMap(@Param("idCard") String idCard);
@ -238,5 +238,5 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<String> icUserCustomerIds(); List<String> icUserCustomerIds();
List<Map<String, String>> getIcUserList(@Param("customerId") String customerId); List<Map<String, String>> getIcUserList(@Param("customerId") String customerId, @Param("columns")List<String> columns);
} }

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -382,12 +382,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
icUserTransferRecordService.add(formDTO); icUserTransferRecordService.add(formDTO);
} }
//2.判断类别数据是否修改[类别修改的变更明细里边存修改后的新值,是就存1否就存-1] //2.判断类别数据是否修改[类别修改的变更明细里边存修改后的新值,是就存1否就存-1]
Result<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(tokenDto.getCustomerId()); IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO();
if (!resultList.success()) { sfdto.setCustomerId(tokenDto.getCustomerId());
throw new RuntimeException("居民信息修改,获取客户居民类别预警配置表数据失败"); 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(); IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
@ -396,7 +399,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//变更明细 //变更明细
List<IcUserChangeDetailedEntity> list = new ArrayList<>(); List<IcUserChangeDetailedEntity> list = new ArrayList<>();
IcUserChangeDetailedEntity categoryEntity = null; IcUserChangeDetailedEntity categoryEntity = null;
for (IcResiCategoryWarnConfigDTO dto : resultList.getData()) { for (IcResiCategoryStatsConfigDTO dto : categoryListResult.getData()) {
String oldValue = hash.get(dto.getColumnName()); String oldValue = hash.get(dto.getColumnName());
if (map.containsKey(dto.getColumnName()) && !oldValue.equals(map.get(dto.getColumnName()))) { if (map.containsKey(dto.getColumnName()) && !oldValue.equals(map.get(dto.getColumnName()))) {
//类别修改后的值 //类别修改后的值

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

@ -21,12 +21,13 @@ 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.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.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserChangeRecordDao; import com.epmet.dao.IcUserChangeRecordDao;
import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcUserChangeRecordDTO; import com.epmet.dto.IcUserChangeRecordDTO;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO; import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcUserChangeRecordInitFormDTO; import com.epmet.dto.form.IcUserChangeRecordInitFormDTO;
@ -171,10 +172,13 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
log.info("开始初始客户下居民的变更记录和变更明细数据,客户Id->"+customerId); log.info("开始初始客户下居民的变更记录和变更明细数据,客户Id->"+customerId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//1.获取客户居民类别预警配置表数据 //1.获取客户居民类别预警配置表数据
Result<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(customerId); IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO();
if (!resultList.success()) { sfdto.setCustomerId(customerId);
throw new RuntimeException("居民信息修改,获取客户居民类别预警配置表数据失败"); Result<List<IcResiCategoryStatsConfigDTO>> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto);
if (!categoryListResult.success()){
throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败");
} }
List<String> columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList());
List<IcUserChangeRecordEntity> changeList = new ArrayList<>(); List<IcUserChangeRecordEntity> changeList = new ArrayList<>();
IcUserChangeRecordEntity change = null; IcUserChangeRecordEntity change = null;
List<IcUserChangeDetailedEntity> detailedList = new ArrayList<>(); List<IcUserChangeDetailedEntity> detailedList = new ArrayList<>();
@ -187,7 +191,7 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
do { do {
//一千条一循环查询客户下居民数据 //一千条一循环查询客户下居民数据
PageHelper.startPage(pageNo, NumConstant.ONE_THOUSAND); PageHelper.startPage(pageNo, NumConstant.ONE_THOUSAND);
icUserList = icResiUserDao.getIcUserList(customerId); icUserList = icResiUserDao.getIcUserList(customerId, columns);
pageNo++; pageNo++;
//3.遍历封装数据 //3.遍历封装数据
@ -195,7 +199,7 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
//存放一个人的类别为是的变更明细数据 //存放一个人的类别为是的变更明细数据
List<IcUserChangeDetailedEntity> subList = new ArrayList<>(); List<IcUserChangeDetailedEntity> subList = new ArrayList<>();
String changeId = UUID.randomUUID().toString().replaceAll("-", ""); String changeId = UUID.randomUUID().toString().replaceAll("-", "");
for (IcResiCategoryWarnConfigDTO dto : resultList.getData()){ for (IcResiCategoryStatsConfigDTO dto : categoryListResult.getData()){
if(map.containsKey(dto.getColumnName())&&"1".equals(map.get(dto.getColumnName()))){ if(map.containsKey(dto.getColumnName())&&"1".equals(map.get(dto.getColumnName()))){
detailed = new IcUserChangeDetailedEntity(); detailed = new IcUserChangeDetailedEntity();
detailed.setCustomerId(customerId); detailed.setCustomerId(customerId);

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

@ -27,6 +27,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserTransferRecordDao; import com.epmet.dao.IcUserTransferRecordDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcResiUserOrgMsgFormDTO; import com.epmet.dto.form.IcResiUserOrgMsgFormDTO;
@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 居民调动记录表 * 居民调动记录表
@ -173,12 +175,15 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
changeRecordEntity.setRemark(formDTO.getRemark()); changeRecordEntity.setRemark(formDTO.getRemark());
icUserChangeRecordService.insert(changeRecordEntity); icUserChangeRecordService.insert(changeRecordEntity);
//6-2.变更明细【类别明细迁出组织的-1,迁入组织的1】 //6-2.变更明细【类别明细迁出组织的-1,迁入组织的1】
Result<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(formDTO.getCustomerId()); IcResiCategoryStatsConfigDTO dto = new IcResiCategoryStatsConfigDTO();
if (!resultList.success()) { dto.setCustomerId(formDTO.getCustomerId());
throw new RuntimeException("人员调动,获取客户居民类别预警配置表数据失败"); Result<List<IcResiCategoryStatsConfigDTO>> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(dto);
if (!categoryListResult.success()){
throw new RenException("人员调动,获取客户居民类别预警配置表数据失败");
} }
Map<String, String> map = icResiUserDao.getCategoryListMap(formDTO.getIcUserId()); List<String> columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList());
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(resultList.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO); Map<String, String> map = icResiUserDao.getCategoryListMap(columns, formDTO.getIcUserId());
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO);
icUserChangeDetailedService.insertBatch(changeDetailedEntityList); icUserChangeDetailedService.insertBatch(changeDetailedEntityList);
} }
@ -231,7 +236,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
* @Author sun * @Author sun
* @Description 变更明细 * @Description 变更明细
**/ **/
private List<IcUserChangeDetailedEntity> saveChangeDetailed(List<IcResiCategoryWarnConfigDTO> configList, Map<String, String> map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) { private List<IcUserChangeDetailedEntity> saveChangeDetailed(List<IcResiCategoryStatsConfigDTO> configList, Map<String, String> map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) {
List<IcUserChangeDetailedEntity> list = new ArrayList<>(); List<IcUserChangeDetailedEntity> list = new ArrayList<>();
IcUserChangeDetailedEntity outEntity = null; IcUserChangeDetailedEntity outEntity = null;
IcUserChangeDetailedEntity inEntity = null; IcUserChangeDetailedEntity inEntity = null;
@ -246,7 +251,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
throw new EpmetException(String.format("查询组织信息失败%s", formDTO.getNewAgencyId())); throw new EpmetException(String.format("查询组织信息失败%s", formDTO.getNewAgencyId()));
} }
} }
for (IcResiCategoryWarnConfigDTO cf : configList) { for (IcResiCategoryStatsConfigDTO cf : configList) {
if ("1".equals(map.get(cf.getColumnName()))) { if ("1".equals(map.get(cf.getColumnName()))) {
//迁出 //迁出
outEntity = new IcUserChangeDetailedEntity(); outEntity = new IcUserChangeDetailedEntity();

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

@ -518,24 +518,9 @@
<select id="getCategoryListMap" resultType="java.util.Map"> <select id="getCategoryListMap" resultType="java.util.Map">
SELECT SELECT
IFNULL(is_kc,'0') IS_KC, <foreach collection="columns" separator="," item="c">
IFNULL(is_cj,'0') IS_CJ, IFNULL(`${c}`,'0') AS `${c}`
IFNULL(is_ylfn,'0') IS_YLFN, </foreach>
IFNULL(is_sn,'0') IS_SN,
IFNULL(is_special,'0') IS_SPECIAL,
IFNULL(is_volunteer,'0') IS_VOLUNTEER,
IFNULL(is_unemployed,'0') IS_UNEMPLOYED,
IFNULL(is_mb,'0') IS_MB,
IFNULL(is_sz,'0') IS_SZ,
IFNULL(is_sd,'0') IS_SD,
IFNULL(is_veterans,'0') IS_VETERANS,
IFNULL(is_ensure_house,'0') IS_ENSURE_HOUSE,
IFNULL(is_party,'0') IS_PARTY,
IFNULL(is_old_people,'0') IS_OLD_PEOPLE,
IFNULL(is_xfry,'0')IS_XFRY,
IFNULL(is_united_front,'0') IS_UNITED_FRONT,
IFNULL(is_db,'0') IS_DB,
IFNULL(is_dbh,'0') IS_DBH
FROM FROM
ic_resi_user ic_resi_user
WHERE WHERE
@ -590,25 +575,13 @@
iru.home_id HOME_ID, iru.home_id HOME_ID,
iru.name NAME, iru.name NAME,
iru.created_by CREATED_BY, iru.created_by CREATED_BY,
date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME, date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME
IFNULL(iru.is_kc,'0') IS_KC, <if test="columns != null and columns.size() > 0">
IFNULL(iru.is_cj,'0') IS_CJ, ,
IFNULL(iru.is_ylfn,'0') IS_YLFN, <foreach collection="columns" separator="," item="c">
IFNULL(iru.is_sn,'0') IS_SN, IFNULL(`${c}`,'0') AS `${c}`
IFNULL(iru.is_special,'0') IS_SPECIAL, </foreach>
IFNULL(iru.is_volunteer,'0') IS_VOLUNTEER, </if>
IFNULL(iru.is_unemployed,'0') IS_UNEMPLOYED,
IFNULL(iru.is_mb,'0') IS_MB,
IFNULL(iru.is_sz,'0') IS_SZ,
IFNULL(iru.is_sd,'0') IS_SD,
IFNULL(iru.is_veterans,'0') IS_VETERANS,
IFNULL(iru.is_ensure_house,'0') IS_ENSURE_HOUSE,
IFNULL(iru.is_party,'0') IS_PARTY,
IFNULL(iru.is_old_people,'0') IS_OLD_PEOPLE,
IFNULL(iru.is_xfry,'0')IS_XFRY,
IFNULL(iru.is_united_front,'0') IS_UNITED_FRONT,
IFNULL(iru.is_db,'0') IS_DB,
IFNULL(iru.is_dbh,'0') IS_DBH
FROM FROM
ic_resi_user iru ic_resi_user iru
<!-- 只查询在变更记录表不存在新增节点的居民 --> <!-- 只查询在变更记录表不存在新增节点的居民 -->

Loading…
Cancel
Save