|
@ -3,19 +3,20 @@ 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.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
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.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|
|
|
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|
|
import com.epmet.dto.form.RentTenantDataFormDTO; |
|
|
import com.epmet.dto.form.RentTenantDataFormDTO; |
|
|
import com.epmet.dto.result.RentTenantDataResultDTO; |
|
|
import com.epmet.dto.result.RentTenantDataResultDTO; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
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.dao.RentBlacklistDao; |
|
|
import com.epmet.plugin.power.modules.rent.entity.RentBlacklistEntity; |
|
|
import com.epmet.plugin.power.modules.rent.entity.RentBlacklistEntity; |
|
|
import com.epmet.plugin.power.modules.rent.redis.RentBlacklistRedis; |
|
|
import com.epmet.plugin.power.modules.rent.redis.RentBlacklistRedis; |
|
|
import com.epmet.plugin.power.modules.rent.service.RentBlacklistService; |
|
|
import com.epmet.plugin.power.modules.rent.service.RentBlacklistService; |
|
@ -39,7 +40,7 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao, |
|
|
private RentBlacklistRedis rentBlacklistRedis; |
|
|
private RentBlacklistRedis rentBlacklistRedis; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetUserOpenFeignClient client; |
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
LoginUserUtil loginUserUtil; |
|
|
LoginUserUtil loginUserUtil; |
|
@ -87,24 +88,26 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao, |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(RentBlacklistDTO dto) { |
|
|
public Result save(RentBlacklistDTO dto) { |
|
|
RentTenantDataFormDTO formDTO = new RentTenantDataFormDTO(); |
|
|
RentTenantDataFormDTO formDTO = new RentTenantDataFormDTO(); |
|
|
formDTO.setUserId(dto.getUserId()); |
|
|
formDTO.setUserId(dto.getUserId()); |
|
|
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
Result<RentTenantDataResultDTO> result = client.tenantData(formDTO); |
|
|
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); |
|
|
|
|
|
Result<RentTenantDataResultDTO> result = epmetUserOpenFeignClient.tenantData(formDTO); |
|
|
|
|
|
|
|
|
dto.setIdCard(result.getData().getIdCard()); |
|
|
dto.setIdCard(result.getData().getIdCard()); |
|
|
dto.setMobile(result.getData().getMobile()); |
|
|
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 RenException("该人员已经在黑名单"); |
|
|
return new Result().error("该人员已经在黑名单"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
dto.setJoinDate(DateUtils.format(new Date())); |
|
|
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); |
|
|
|
|
|
return new Result(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|