Browse Source

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

 Conflicts:
	epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
dev
jianjun 3 years ago
parent
commit
eb494e3c03
  1. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  3. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java
  4. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
  5. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  6. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java
  7. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java
  8. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java
  9. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java
  10. 42
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  11. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  12. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.36__ic_nat_normal.sql
  13. 21
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  14. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -170,8 +170,13 @@ public class HouseController implements ResultDataResolver {
return new Result();
}
/**
* lzh
* @param formDTO
* @return 单独删除房屋内部调用/gov/org/house/delete
*/
@PostMapping("housedel")
public Result houseDel(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
public Result houseDel(@RequestBody IcHouseFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class);
houseService.delHouse(formDTO.getHouseId());

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -157,7 +157,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
//单个删除房屋,房屋内有居民不允许删除
NeighborHoodManageDelFormDTO formDTO=new NeighborHoodManageDelFormDTO();
formDTO.setType(CustomerGridConstant.HOUSE);
formDTO.setIds(Arrays.asList(houseId));
List<String> ids=new ArrayList<>();
ids.add(houseId);
formDTO.setIds(ids);
allDelete(formDTO);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java

@ -63,6 +63,21 @@ public class IcNatController implements ResultDataResolver {
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
/**
* 记录一下核酸记录模块的业务程序逻辑防止后续理不清 ic_nat:基础信息表 ic_nat_relation:关系表
* 1.数字平台导入时按身份证检测时间查询数据查到数据不是导入的状态则记录下并跳过是导入数据更新结果未查到直接新增
* 是否居民以及userId值查询数据平台居民能查到就相应的赋值
* 2.居民端录入可以录自己的或别人的但是数据属于当前录入的组织
* 3.数据平台录入可以为已有居民录入也可以录新数据新数据则是否居民和userId无值
* 4.导入数据不允许修改删除录入数据可以修改删除删除时相应的删除基础表和可能存在的所有关心表数据
* 数据同步可多次重复只是修改对应的关系表数据基础信息表数据公用
* 5.同一条数据被A街道和A社区都同步了街道在看本辖区数据时会看到两条但是只有A街道的那一条才能看到取消同步按钮
* 6.数据库一个人一个检测时间只存在一条记录以导入数据结果为准已导入的各项值都不能修改即使错误也只能通过导入修改
* 7.新增删除居民时会相应的修改基础信息表是否居民以及userId的值
* 1.导入数据不允许修改是觉得导入数据是官方提供的且没有问题的数据不需要在平台有维护操作只要看就可以了
* 2.是否居民的查询条件以及是否居民的列标题在看整个客户列表数据时这两个都隐藏
*
*/
/**
* @Author sun

11
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java

@ -46,6 +46,7 @@ public interface IcNatDao extends BaseDao<IcNatEntity> {
/**
* 插入或者更新
*
* @param e
*/
void insertOrUpdate(IcNatEntity e);
@ -55,4 +56,14 @@ public interface IcNatDao extends BaseDao<IcNatEntity> {
* @Description 按条件查询业务数据
**/
IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime, @Param("natResult") String natResult);
/**
* desc:根据客户id 更新是否居民状态
*
* @param customerId
* @param icResiUserId 如果为空则更新全部
* @return
*/
int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId);
}

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

@ -54,15 +54,16 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
**/
void upTable(@Param("tableName") String tableName, @Param("id") String id, @Param("map") Map<String, ?> map);
List<Map<String,Object>> selectListResiMap(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables,
@Param("currentStaffAgencyId")String currentStaffAgencyId,
@Param("staffOrgPath") String staffOrgPath,
@Param("resultTableName")String resultTableName,
@Param("keyword") String keyword);
List<Map<String, Object>> selectListResiMap(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables,
@Param("currentStaffAgencyId") String currentStaffAgencyId,
@Param("staffOrgPath") String staffOrgPath,
@Param("resultTableName") String resultTableName,
@Param("keyword") String keyword);
/**
* 查询主表
*
@ -238,11 +239,11 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
Map<String, String> getCategoryListMap(@Param("columns")List<String> columns, @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, @Param("resiId") String resiId);
List<Map<String,Object>> selectResiUsers(@Param("types")List<String> types,@Param("orgId")String orgId);
List<Map<String, Object>> selectResiUsers(@Param("types") List<String> types, @Param("orgId") String orgId);
List<String> icUserCustomerIds();
@ -254,9 +255,9 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
* @param customerId
* @param tableName
* @param columnList
* @param id 非必填 leve有值时 必填
* @param level 非必填
* @return java.util.Map<java.lang.String,java.math.BigDecimal> 字段名数量
* @param id 非必填 leve有值时 必填
* @param level 非必填
* @return java.util.Map<java.lang.String, java.math.BigDecimal> 字段名数量
* @author LiuJanJun
* @date 2022/2/12 3:03 下午
*/
@ -266,6 +267,7 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
/**
* Desc: 根据房屋IDs查询房屋下是否有存在居民的
*
* @param ids
* @author zxc
* @date 2022/3/2 10:32 上午
@ -274,6 +276,7 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
/**
* 居民防疫信息查询
*
* @Param formDTO
* @Return {@link List< EpidemicPreventionResultDTO>}
* @Author zhaoqifeng
@ -282,6 +285,8 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<EpidemicPreventionResultDTO> getEpidemicPreventionList(EpidemicPreventionFormDTO formDTO);
List<EpidemicPreventionResultDTO> natList(EpidemicPreventionFormDTO formDTO);
List<EpidemicPreventionResultDTO> vaccineList(EpidemicPreventionFormDTO formDTO);
IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java

@ -2,8 +2,8 @@ package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.epmet.dto.form.AddIcNatFormDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -25,6 +25,7 @@ public class IcNatImportExcelData {
@NotBlank(message = "身份证号为必填项")
@ExcelProperty("身份证号")
@Length(max = 18, message = "身份证号长度不正确,应小于18位")
private String idCard;
@NotNull(message = "检测时间为必填项")

15
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java

@ -26,7 +26,7 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
/**
* 最大条数阈值
*/
public static final int MAX_THRESHOLD = 2;
public static final int MAX_THRESHOLD = 200;
private String currentUserId;
/**
@ -66,6 +66,19 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
// 先校验数据
ValidatorUtils.validateEntity(data);
if (StringUtils.isNotBlank(data.getName())) {
data.setName(data.getName().trim());
}
if (StringUtils.isNotBlank(data.getMobile())) {
data.setMobile(data.getMobile().trim());
}
if (StringUtils.isNotBlank(data.getNatAddress())) {
data.setNatAddress(data.getNatAddress().trim());
}
if (StringUtils.isNotBlank(data.getIdCard())) {
data.setIdCard(data.getIdCard().trim());
}
// 默认空,没有结果
String natResult = "";
String natResultZh = data.getNatResultZh();

25
epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java

@ -9,6 +9,8 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.SystemMessageType;
import com.epmet.service.IcNatService;
import com.epmet.service.StatsResiWarnService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -71,6 +73,9 @@ public class ICWarnStatsEventListener implements MessageListenerConcurrently {
30L, 30L, TimeUnit.SECONDS);
//待执行方法
SpringContextUtils.getBean(StatsResiWarnService.class).resiWarn(obj.getCustomerId());
//根据居民Id更新 核酸检测的是否居民状态
updateIcNatResiFlag(tags, obj);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【开放数据事件监听器】-客户居民信息变动MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
@ -91,6 +96,26 @@ public class ICWarnStatsEventListener implements MessageListenerConcurrently {
}
}
/**
* desc:根据居民Id更新 核酸检测的是否居民状态(只有新增和删除时调用)
* @param tags
* @param obj
*/
private void updateIcNatResiFlag(String tags, IcResiUserAddMQMsg obj) {
try {
if (StringUtils.isBlank(obj.getCustomerId())||StringUtils.isBlank(obj.getIcResiUser())){
log.warn("updateIcNatResiFlag param is error");
return;
}
if (SystemMessageType.IC_RESI_USER_ADD.equals(tags) || SystemMessageType.IC_RESI_USER_DEL.equals(tags)) {
Integer effectRow = SpringContextUtils.getBean(IcNatService.class).updateIsResiFlag(obj.getCustomerId(), obj.getIcResiUser());
log.debug("updateIcNatResiFlag effectRow:{},param customerId & icResiUserId:{}", effectRow, JSON.toJSONString(obj));
}
} catch (Exception e) {
log.error("updateIcNatResiFlag exception", e);
}
}
/**
* @description
*

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java

@ -84,4 +84,12 @@ public interface IcNatService extends BaseService<IcNatEntity> {
* @Date 2022/3/29 16:29
*/
List<NatListDTO> getNatList(String customerId, String idCard);
/**
* desc:根据用户id 更新核酸中是否居民状态
* @param customerId
* @param icResiUserId 如果为空则更新全部
* @return
*/
Integer updateIsResiFlag(String customerId, String icResiUserId);
}

42
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -2,12 +2,10 @@ package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
@ -26,7 +24,10 @@ import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.AddIcNatFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.MyNatListFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcNatEntity;
import com.epmet.entity.IcNatRelationEntity;
@ -38,6 +39,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcNatService;
import com.epmet.service.IcNoticeService;
import com.epmet.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -83,6 +85,8 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
private IcNatRelationDao icNatRelationDao;
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private UserService userService;
/**
* @Author sun
@ -313,9 +317,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
String app = EpmetRequestHolder.getHeader(AppClientConstant.APP);
String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT);
LoginUserDetailsFormDTO ludf = new LoginUserDetailsFormDTO(app, client, userId);
LoginUserDetailsResultDTO loginUserDetails = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(ludf), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(), "调用user出错", "");
LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId);
String agencyId = loginUserDetails.getAgencyId();
@ -436,6 +438,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
}).collect(Collectors.toList());
}
@Override
public Integer updateIsResiFlag(String customerId, String icResiUserId) {
return baseDao.updateIsResiFlag(customerId,icResiUserId);
}
/**
* 批量持久化
* @param entities
@ -510,15 +517,15 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
needUpdate = true;
}
// 检测地点和手机号先不提示,说需要提示再提示
if (!natAddress.equals(resiNat.getNatAddress())) {
changedFieldNames.add("检测地点");
resiNat.setNatResult(natAddress);
// 检测地点和手机号先不提示,说需要提示再提示。需要考虑两个都不为空&&不相等 || 两个中一个为空一个不为空
if ((StringUtils.isBlank(natAddress) && StringUtils.isNotBlank(resiNat.getNatAddress()))
|| (StringUtils.isNotBlank(natAddress) && StringUtils.isBlank(resiNat.getNatAddress()))
|| (StringUtils.isNotBlank(natAddress) && StringUtils.isNotBlank(resiNat.getNatAddress()) && !natAddress.equals(resiNat.getNatAddress()))) {
resiNat.setNatAddress(natAddress);
needUpdate = true;
}
if (!mobile.equals(resiNat.getMobile())) {
changedFieldNames.add("手机号");
resiNat.setMobile(mobile);
needUpdate = true;
}
@ -537,6 +544,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
if (needUpdate) {
resiNat.setUpdatedBy(currentUserId);
resiNat.setUpdatedTime(new Date());
IcResiUserEntity resi = getResi(customerId, idCard);
resiNat.setIsResiUser(resi != null ? "1" : "0");
resiNat.setUserId(resi != null ? resi.getId() : "");
baseDao.updateById(resiNat);
}
@ -547,7 +559,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
}
// 执行新增操作
e.setIsResiUser(isResi(customerId, idCard));
IcResiUserEntity resi = getResi(customerId, idCard);
e.setIsResiUser(resi != null ? "1" : "0");
e.setUserId(resi != null ? resi.getId() : "");
e.setUserType("import");
baseDao.insert(e);
@ -564,11 +578,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
* @param idCard
* @return
*/
public String isResi(String customerId, String idCard) {
public IcResiUserEntity getResi(String customerId, String idCard) {
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper();
query.eq(IcResiUserEntity::getCustomerId, customerId);
query.eq(IcResiUserEntity::getIdCard, idCard);
return icResiUserDao.selectCount(query) > 0 ? "1" : "0";
return icResiUserDao.selectOne(query);
}
/**

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

@ -79,6 +79,7 @@ import java.sql.Timestamp;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -866,11 +867,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
throw new RenException(buildResult.getCode(),buildResult.getMsg());
}
Map<String, String> buildMap = buildResult.getData().stream().collect(Collectors.toMap(BuildingResultDTO::getBuildingId, BuildingResultDTO::getBuildingName));
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
result.forEach(item -> {
item.setGridName(gridMap.get(item.getGridId()));
item.setNeighborHoodName(neighborHoodMap.get(item.getNeighborHoodId()));
item.setBuildNum(buildMap.get(item.getBuildId()));
item.setSort(i.getAndIncrement());
});
return new PageData<>(result, pageInfo.getTotal());

4
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.36__ic_nat_normal.sql

@ -0,0 +1,4 @@
ALTER TABLE `ic_nat`
MODIFY COLUMN `USER_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据来源【居民端小程序的人:resi;\r\n数字社区的居民:icresi;\r\n导入的:import;】' AFTER `USER_ID`,
ADD INDEX `idx_ic_card` (`ID_CARD`) USING BTREE ;

21
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -69,7 +69,7 @@
<if test='null != isResiUser and "" != isResiUser'>
AND b.is_resi_user = #{isResiUser}
</if>
ORDER BY b.nat_time DESC
ORDER BY b.nat_time DESC, b.id ASC
</select>
<select id="getCustomerNatList" resultType="com.epmet.dto.result.NatListResultDTO">
@ -104,7 +104,7 @@
<if test='null != endTime and "" != endTime'>
AND nat_time <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY nat_time DESC
ORDER BY nat_time DESC, id ASC
</select>
<select id="getNatDTO" resultType="com.epmet.dto.IcNatDTO">
@ -156,4 +156,21 @@
UPDATED_BY=#{updatedBy},
UPDATED_TIME=NOW()
</insert>
<update id="updateIsResiFlag">
UPDATE ic_nat m,
(
SELECT if(DEL_FLAG,0,1) resiFlag, ID_CARD FROM ic_resi_user
WHERE
1=1
<if test="icResiUserId != null and icResiUserId != ''">
AND ID = #{icResiUserId}
</if>
AND CUSTOMER_ID = #{customerId}
AND DEL_FLAG = '0'
) t
SET m.IS_RESI_USER = t.resiFlag
WHERE
m.ID_CARD = t.ID_CARD
AND m.DEL_FLAG = '0'
</update>
</mapper>

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

@ -797,4 +797,7 @@
</if>
ORDER BY `NAME`
</select>
<select id="selectResiNoDelFlag" resultType="com.epmet.entity.IcResiUserEntity">
SELECT ID,NAME,ID_CARD,DEL_FLAG FROM ic_resi_user WHERE ID = #{icResiUserId}
</select>
</mapper>

Loading…
Cancel
Save