|
@ -3,11 +3,17 @@ package com.epmet.plugin.power.modules.rent.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.exception.EpmetException; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
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.security.user.LoginUserUtil; |
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.dto.form.RentTenantDataFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.RentTenantDataResultDTO; |
|
|
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.plugin.power.modules.rent.dao.RentBlacklistDao; |
|
|
import com.epmet.plugin.power.modules.rent.dao.RentBlacklistDao; |
|
|
import com.epmet.plugin.power.dto.rent.RentBlacklistDTO; |
|
|
import com.epmet.plugin.power.dto.rent.RentBlacklistDTO; |
|
|
import com.epmet.plugin.power.modules.rent.entity.RentBlacklistEntity; |
|
|
import com.epmet.plugin.power.modules.rent.entity.RentBlacklistEntity; |
|
@ -18,10 +24,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.Arrays; |
|
|
import java.util.*; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 黑名单表 |
|
|
* 黑名单表 |
|
@ -35,6 +38,9 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao, |
|
|
@Autowired |
|
|
@Autowired |
|
|
private RentBlacklistRedis rentBlacklistRedis; |
|
|
private RentBlacklistRedis rentBlacklistRedis; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetUserOpenFeignClient client; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
LoginUserUtil loginUserUtil; |
|
|
LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
@ -82,12 +88,20 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao, |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(RentBlacklistDTO dto) { |
|
|
public void save(RentBlacklistDTO dto) { |
|
|
|
|
|
RentTenantDataFormDTO formDTO = new RentTenantDataFormDTO(); |
|
|
|
|
|
formDTO.setUserId(dto.getUserId()); |
|
|
|
|
|
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
|
|
Result<RentTenantDataResultDTO> result = client.tenantData(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
dto.setIdCard(result.getData().getIdCard()); |
|
|
|
|
|
dto.setMobile(result.getData().getMobile()); |
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
params.put("idCard", dto.getIdCard()); |
|
|
params.put("idCard", dto.getIdCard()); |
|
|
if (!list(params).isEmpty()) { |
|
|
if (!list(params).isEmpty()) { |
|
|
throw new EpmetException("该人员已经在黑名单"); |
|
|
throw new RenException("该人员已经在黑名单"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dto.setJoinDate(DateUtils.format(new Date())); |
|
|
RentBlacklistEntity entity = ConvertUtils.sourceToTarget(dto, RentBlacklistEntity.class); |
|
|
RentBlacklistEntity entity = ConvertUtils.sourceToTarget(dto, RentBlacklistEntity.class); |
|
|
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
insert(entity); |
|
|
insert(entity); |
|
@ -96,8 +110,10 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao, |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void update(RentBlacklistDTO dto) { |
|
|
public void update(RentBlacklistDTO dto) { |
|
|
|
|
|
dto.setRemoveReason(DateUtils.format(new Date())); |
|
|
RentBlacklistEntity entity = ConvertUtils.sourceToTarget(dto, RentBlacklistEntity.class); |
|
|
RentBlacklistEntity entity = ConvertUtils.sourceToTarget(dto, RentBlacklistEntity.class); |
|
|
updateById(entity); |
|
|
updateById(entity); |
|
|
|
|
|
baseDao.deleteBatchIds(Collections.singletonList(entity.getId())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|