Browse Source

更新房东的头像

dev_power_axis
zhangyuan 3 years ago
parent
commit
4ee60f6d13
  1. 38
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java
  2. 31
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java
  3. 42
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java
  4. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml
  5. 16
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java
  6. 3
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentBlacklistService.java
  7. 19
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java
  8. 16
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java
  9. 34
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java

38
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java

@ -1,10 +1,9 @@
package com.epmet.plugin.power.dto.rent;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -26,11 +25,13 @@ public class RentBlacklistDTO implements Serializable {
/**
* epmet用户主键
*/
@NotBlank(message = "用户ID不能为空")
private String userId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
private String name;
/**
@ -42,16 +43,19 @@ public class RentBlacklistDTO implements Serializable {
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
private String mobile;
/**
* 性别 0女 1男
*/
@NotBlank(message = "性别不能为空")
private String gender;
/**
* 类型 0 租客 1 房东
*/
@NotBlank(message = "人员类型不能为空")
private String type;
/**
@ -74,34 +78,4 @@ public class RentBlacklistDTO implements Serializable {
*/
private String removeReason;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

31
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java

@ -5,7 +5,6 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -170,36 +169,6 @@ public class RentContractInfoDTO implements Serializable {
*/
private String reason;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 租客列表
*/

42
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java

@ -1,11 +1,12 @@
package com.epmet.plugin.power.dto.rent;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
/**
* 租客表
@ -31,16 +32,19 @@ public class RentTenantInfoDTO implements Serializable {
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
private String name;
/**
* 身份证
*/
@NotBlank(message = "身份证不能为空")
private String idCard;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
private String mobile;
/**
@ -51,41 +55,13 @@ public class RentTenantInfoDTO implements Serializable {
/**
* 人员类型 0房东 1租客
*/
@NotBlank(message = "人员类型不能为空")
private String type;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 头像列表
*/
@NotEmpty
private List<RentContractFileDTO> imgList;
}

2
epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml

@ -193,7 +193,7 @@
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip>192.168.43.26</nacos.ip>
<nacos.ip>192.168.43.104</nacos.ip>
<!--是否开启服务列表变更监听-->
<nacos.service-list-changed-listening.enable>false</nacos.service-list-changed-listening.enable>

16
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java

@ -34,29 +34,28 @@ public class RentBlacklistController {
private RentBlacklistService rentBlacklistService;
@RequestMapping("page")
public Result<PageData<RentBlacklistDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<RentBlacklistDTO>> page(@RequestParam Map<String, Object> params) {
PageData<RentBlacklistDTO> page = rentBlacklistService.page(params);
return new Result<PageData<RentBlacklistDTO>>().ok(page);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<RentBlacklistDTO> get(@PathVariable("id") String id){
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
public Result<RentBlacklistDTO> get(@PathVariable("id") String id) {
RentBlacklistDTO data = rentBlacklistService.get(id);
return new Result<RentBlacklistDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody RentBlacklistDTO dto){
public Result save(@RequestBody RentBlacklistDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
rentBlacklistService.save(dto);
return new Result();
return rentBlacklistService.save(dto);
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody RentBlacklistDTO dto){
public Result update(@RequestBody RentBlacklistDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
rentBlacklistService.update(dto);
@ -64,7 +63,7 @@ public class RentBlacklistController {
}
@DeleteMapping("delete")
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
rentBlacklistService.delete(ids);
@ -78,5 +77,4 @@ public class RentBlacklistController {
}
}

3
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentBlacklistService.java

@ -2,6 +2,7 @@ package com.epmet.plugin.power.modules.rent.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.plugin.power.dto.rent.RentBlacklistDTO;
import com.epmet.plugin.power.modules.rent.entity.RentBlacklistEntity;
@ -54,7 +55,7 @@ public interface RentBlacklistService extends BaseService<RentBlacklistEntity> {
* @author generator
* @date 2022-04-22
*/
void save(RentBlacklistDTO dto);
Result save(RentBlacklistDTO dto);
/**
* 默认更新

19
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java

@ -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.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.constant.FieldConstant;
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.constant.FieldConstant;
import com.epmet.commons.tools.utils.DateUtils;
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.result.RentTenantDataResultDTO;
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.modules.rent.dao.RentBlacklistDao;
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.service.RentBlacklistService;
@ -39,7 +40,7 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao,
private RentBlacklistRedis rentBlacklistRedis;
@Autowired
private EpmetUserOpenFeignClient client;
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
LoginUserUtil loginUserUtil;
@ -87,24 +88,26 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl<RentBlacklistDao,
@Override
@Transactional(rollbackFor = Exception.class)
public void save(RentBlacklistDTO dto) {
public Result save(RentBlacklistDTO dto) {
RentTenantDataFormDTO formDTO = new RentTenantDataFormDTO();
formDTO.setUserId(dto.getUserId());
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.setMobile(result.getData().getMobile());
Map<String, Object> params = new HashMap<>(4);
params.put("idCard", dto.getIdCard());
if (!list(params).isEmpty()) {
throw new RenException("该人员已经在黑名单");
return new Result().error("该人员已经在黑名单");
}
dto.setJoinDate(DateUtils.format(new Date()));
RentBlacklistEntity entity = ConvertUtils.sourceToTarget(dto, RentBlacklistEntity.class);
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId());
insert(entity);
return new Result();
}
@Override

16
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

@ -5,7 +5,8 @@ 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.RenException;
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;
@ -155,8 +156,13 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
public void review(RentContractInfoDTO dto) {
RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class);
updateById(entity);
// 如果审核通过,就去更新基础库
if (NumConstant.ONE_STR.equals(entity.getState())) {
// todo 更新头像到产品人员库
dto.getTenantList().forEach(tenant->{
});
}
}
@ -184,7 +190,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
rentContractFileService.deletePhysical(params);
if (dto.getTenantList().isEmpty()) {
throw new RenException("租客不能为空");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客不能为空");
} else {
List<RentTenantInfoEntity> tenantList = ConvertUtils.sourceToTarget(dto.getTenantList(), RentTenantInfoEntity.class);
tenantList.forEach(tenant -> {
@ -202,7 +208,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
// 处理租客头像
dto.getTenantList().forEach(tenant -> {
if (tenant.getImgList().isEmpty()) {
throw new RenException("租客照片不能为空");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客照片不能为空");
} else {
List<RentContractFileEntity> imgList = ConvertUtils.sourceToTarget(tenant.getImgList(), RentContractFileEntity.class);
imgList.forEach(img -> {
@ -216,7 +222,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
}
if (dto.getFileList().isEmpty()) {
throw new RenException("合同附件不能为空");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "合同附件不能为空");
} else {
List<RentContractFileEntity> fileList = ConvertUtils.sourceToTarget(dto.getFileList(), RentContractFileEntity.class);
fileList.forEach(item -> {

34
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java

@ -5,10 +5,15 @@ 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.RenException;
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.dto.IcResiUserAttachmentDTO;
import com.epmet.dto.form.RentTenantFormDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO;
import com.epmet.plugin.power.modules.rent.dao.RentTenantInfoDao;
import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity;
@ -21,6 +26,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;
@ -40,6 +46,12 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao
@Autowired
LoginUserUtil loginUserUtil;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private RentContractFileService rentContractFileService;
@ -81,9 +93,10 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao
@Override
@Transactional(rollbackFor = Exception.class)
public void save(RentTenantInfoDTO dto) {
List<IcResiUserAttachmentDTO> images = new ArrayList<>();
// 处理头像
if (dto.getImgList().isEmpty()) {
throw new RenException("照片不能为空");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "照片不能为空");
} else {
RentTenantInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentTenantInfoEntity.class);
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId());
@ -94,12 +107,23 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao
img.setReferenceId(entity.getId());
img.setFileType(NumConstant.ZERO_STR);
img.setCustomerId(loginUserUtil.getLoginUserCustomerId());
// 更新基础库的人员头像
IcResiUserAttachmentDTO image = new IcResiUserAttachmentDTO();
image.setAttachmentUrl(img.getFileUrl());
image.setCustomerId(loginUserUtil.getLoginUserCustomerId());
images.add(image);
});
rentContractFileService.insertBatch(imgList);
}
if (NumConstant.ZERO_STR.equals(dto.getType())) {
// todo 更新头像到产品人员库
// 如果是房东信息立马去更新照片
if (NumConstant.ZERO_STR.equals(dto.getType())) {
RentTenantFormDTO formDTO = new RentTenantFormDTO();
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId());
formDTO.setIdCard(dto.getIdCard());
formDTO.setImages(images);
epmetUserOpenFeignClient.rentUpdate(formDTO);
}
}
}

Loading…
Cancel
Save