From 4ee60f6d138e3088a949388787e91e51ff20ef1d Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 27 Apr 2022 15:45:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=88=BF=E4=B8=9C=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../power/dto/rent/RentBlacklistDTO.java | 38 +++-------------- .../power/dto/rent/RentContractInfoDTO.java | 31 -------------- .../power/dto/rent/RentTenantInfoDTO.java | 42 ++++--------------- .../pli-power-base-server/pom.xml | 2 +- .../controller/RentBlacklistController.java | 16 ++++--- .../rent/service/RentBlacklistService.java | 3 +- .../impl/RentBlacklistServiceImpl.java | 19 +++++---- .../impl/RentContractInfoServiceImpl.java | 16 ++++--- .../impl/RentTenantInfoServiceImpl.java | 34 ++++++++++++--- 9 files changed, 76 insertions(+), 125 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java index 8c98b7b..f0ff8cb 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java +++ b/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; - } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java index 0431d6b..c540588 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java +++ b/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; - /** * 租客列表 */ diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java index 80525ea..e7ffb7b 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java +++ b/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 imgList; } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml index ba1db0d..cca48e1 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml @@ -193,7 +193,7 @@ false - 192.168.43.26 + 192.168.43.104 false diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java index 12ac4ce..a7f68f2 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java +++ b/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> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = rentBlacklistService.page(params); return new Result>().ok(page); } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { RentBlacklistDTO data = rentBlacklistService.get(id); return new Result().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 { } - } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentBlacklistService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentBlacklistService.java index 13fe18e..8f9b8a5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentBlacklistService.java +++ b/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 { * @author generator * @date 2022-04-22 */ - void save(RentBlacklistDTO dto); + Result save(RentBlacklistDTO dto); /** * 默认更新 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java index 28204a4..38805dd 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java +++ b/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 result = client.tenantData(formDTO); + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); + Result result = epmetUserOpenFeignClient.tenantData(formDTO); dto.setIdCard(result.getData().getIdCard()); dto.setMobile(result.getData().getMobile()); Map 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 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java index 4235406..4acff95 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java +++ b/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{ + + + + }); } } @@ -184,7 +190,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl tenantList = ConvertUtils.sourceToTarget(dto.getTenantList(), RentTenantInfoEntity.class); tenantList.forEach(tenant -> { @@ -202,7 +208,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl { if (tenant.getImgList().isEmpty()) { - throw new RenException("租客照片不能为空"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客照片不能为空"); } else { List imgList = ConvertUtils.sourceToTarget(tenant.getImgList(), RentContractFileEntity.class); imgList.forEach(img -> { @@ -216,7 +222,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl fileList = ConvertUtils.sourceToTarget(dto.getFileList(), RentContractFileEntity.class); fileList.forEach(item -> { diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java index fb2c69f..17b84e9 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java +++ b/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 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