Browse Source

死亡人员管理增加恢复按钮,点击恢复按钮,恢复居民的信息到居民信息中,死亡人员管理中删除该居民的迁出记录,并增加变更记录

master
wanggongfeng 3 years ago
parent
commit
2f90938258
  1. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeDeathController.java
  2. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeDeathService.java
  3. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeDeathServiceImpl.java

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

@ -13,6 +13,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ChangeDeathDTO;
import com.epmet.dto.form.OnlyIdFormDTO;
import com.epmet.excel.ChangeDeathExcel;
import com.epmet.service.ChangeDeathService;
import org.apache.commons.collections4.CollectionUtils;
@ -94,6 +95,20 @@ public class ChangeDeathController {
ExcelUtils.exportEpmetExcel(response, null, list, ChangeDeathExcel.class);
}
/**
* 恢复死亡人员
* @param tokenDto
* @param dto
* @return
*/
@PostMapping("recovery")
public Result recovery(@LoginUser TokenDto tokenDto,@RequestBody OnlyIdFormDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
changeDeathService.recovery(tokenDto,dto);
return new Result();
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeDeathService.java

@ -2,8 +2,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ChangeDeathDTO;
import com.epmet.dto.form.OnlyIdFormDTO;
import com.epmet.entity.ChangeDeathEntity;
import java.util.List;
@ -76,4 +78,12 @@ public interface ChangeDeathService extends BaseService<ChangeDeathEntity> {
* @date 2022-05-05
*/
void delete(String[] ids);
/**
* 恢复迁出人员
* @return
*/
void recovery(TokenDto tokenDto, OnlyIdFormDTO dto);
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeDeathServiceImpl.java

@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
@ -17,18 +20,19 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dao.ChangeDeathDao;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.ChangeDeathDTO;
import com.epmet.dto.ChangeWelfareDTO;
import com.epmet.dto.form.IcResiUserTransferFormDTO;
import com.epmet.dto.form.OnlyIdFormDTO;
import com.epmet.dto.form.RentTenantDataFormDTO;
import com.epmet.dto.result.RentTenantDataResultDTO;
import com.epmet.entity.ChangeDeathEntity;
import com.epmet.entity.ChangeRelocationEntity;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.redis.ChangeDeathRedis;
import com.epmet.service.ChangeDeathService;
import com.epmet.service.ChangeWelfareService;
import com.epmet.service.IcResiUserService;
import com.epmet.service.IcUserTransferRecordService;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -65,6 +69,11 @@ public class ChangeDeathServiceImpl extends BaseServiceImpl<ChangeDeathDao, Chan
@Autowired
private ChangeRelocationServiceImpl changeRelocationServiceImpl;
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private IcUserChangeRecordService icUserChangeRecordService;
@Override
public PageData<ChangeDeathDTO> page(Map<String, Object> params) {
params.put("customerId", loginUserUtil.getLoginUserCustomerId());
@ -201,4 +210,34 @@ public class ChangeDeathServiceImpl extends BaseServiceImpl<ChangeDeathDao, Chan
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public void recovery(TokenDto tokenDto, OnlyIdFormDTO dto) {
// 更新用户基础信息用户状态信息
ChangeDeathEntity changeDeathEntity = baseDao.selectById(dto.getId());
IcResiUserEntity icResiUserEntity = icResiUserDao.selectById(changeDeathEntity.getUserId());
icResiUserEntity.setStatus("0");
icResiUserEntity.setSubStatus("52");
icResiUserDao.updateById(icResiUserEntity);
// 添加迁出恢复记录
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(tokenDto.getCustomerId());
changeRecordEntity.setOperatorId(tokenDto.getUserId());
changeRecordEntity.setIcUserId(icResiUserEntity.getId());
changeRecordEntity.setOperatorName(staffInfoCache.getRealName());
changeRecordEntity.setIcUserName(icResiUserEntity.getName());
changeRecordEntity.setType("recovery_death");
changeRecordEntity.setTypeName("恢复死亡");
changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity);
// 清除迁出表数据
baseDao.deleteById(dto.getId());
}
}

Loading…
Cancel
Save