|
|
|
@ -5,11 +5,10 @@ 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.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.IcResiUserAttachmentDTO; |
|
|
|
import com.epmet.dto.form.RentTenantFormDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
@ -25,10 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 租客表 |
|
|
|
@ -70,11 +66,13 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao |
|
|
|
private QueryWrapper<RentTenantInfoEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
String contractId = (String) params.get("contractId"); |
|
|
|
String idCard = (String) params.get("idCard"); |
|
|
|
String type = (String) params.get("type"); |
|
|
|
|
|
|
|
QueryWrapper<RentTenantInfoEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(contractId), "CONTRACT_ID", contractId); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(idCard), "ID_CARD", idCard); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(type), "TYPE", type); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
@ -88,11 +86,17 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(RentTenantInfoDTO dto) { |
|
|
|
public Result save(RentTenantInfoDTO dto) { |
|
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
|
params.put("idCard",dto.getIdCard()); |
|
|
|
if(!list(params).isEmpty()){ |
|
|
|
return new Result().error("用户已存在"); |
|
|
|
} |
|
|
|
|
|
|
|
List<IcResiUserAttachmentDTO> images = new ArrayList<>(); |
|
|
|
// 处理头像
|
|
|
|
if (dto.getImgList().isEmpty()) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "照片不能为空"); |
|
|
|
return new Result().error("照片不能为空"); |
|
|
|
} else { |
|
|
|
RentTenantInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentTenantInfoEntity.class); |
|
|
|
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
@ -122,6 +126,7 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao |
|
|
|
epmetUserOpenFeignClient.updateImage(formDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|