From f424423fa553e7cc6095e828d02efc1bc9a0be8a Mon Sep 17 00:00:00 2001 From: Kurisu Date: Fri, 19 Feb 2021 16:33:22 +0800 Subject: [PATCH] :sparkles: 事故车线索录入,校验手机号必填,非正常手机号拨号时直接返回该号码 --- fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/AccidentPoolDTO.java | 1 + fw-valhalla-server/src/test/java/cn/fw/valhalla/ValhallaAppTests.java | 6 ++++++ fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java | 4 ++++ fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/AccidentPoolDTO.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/AccidentPoolDTO.java index 39e80a7..b97b8c2 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/AccidentPoolDTO.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/AccidentPoolDTO.java @@ -29,6 +29,7 @@ public class AccidentPoolDTO { /** * 报案手机号 */ + @NotBlank(message = "报案手机号不能为空") private String reportMobile; /** * 车牌号 diff --git a/fw-valhalla-server/src/test/java/cn/fw/valhalla/ValhallaAppTests.java b/fw-valhalla-server/src/test/java/cn/fw/valhalla/ValhallaAppTests.java index 114550a..639c6e0 100644 --- a/fw-valhalla-server/src/test/java/cn/fw/valhalla/ValhallaAppTests.java +++ b/fw-valhalla-server/src/test/java/cn/fw/valhalla/ValhallaAppTests.java @@ -1,5 +1,6 @@ package cn.fw.valhalla; +import cn.fw.common.util.ValidationUtils; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -35,4 +36,9 @@ class ValhallaAppTests { .andDo(MockMvcResultHandlers.print()); } + @Test + public void phoneTest() { + String phone ="+8619142820251"; + System.out.println(ValidationUtils.checkMobile(phone)); + } } diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java index d9e6cd9..c81aae5 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java @@ -1,5 +1,6 @@ package cn.fw.valhalla.service.bus; +import cn.fw.common.util.ValidationUtils; import cn.fw.valhalla.common.constant.RoleCode; import cn.fw.valhalla.domain.db.customer.AccidentPool; import cn.fw.valhalla.domain.db.customer.Customer; @@ -77,6 +78,9 @@ public class CommonService { AccidentPool accidentPool = accidentPoolService.getById(cusId); BV.notNull(accidentPool, () -> "用户不存在"); becallNo = accidentPool.getReportMobile(); + if (!ValidationUtils.checkMobile(becallNo)) { + return becallNo; + } } else { Customer customer = customerService.queryByIdWithInvalid(cusId); BV.notNull(customer, () -> "用户不存在"); diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java index 6a9c568..a8e1880 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java @@ -1,6 +1,7 @@ package cn.fw.valhalla.service.bus.follow.strategy.impl; import cn.fw.common.exception.BusinessException; +import cn.fw.common.util.ValidationUtils; import cn.fw.valhalla.common.utils.DateUtil; import cn.fw.valhalla.common.utils.MobileUtil; import cn.fw.valhalla.common.utils.StringUtils; @@ -93,7 +94,7 @@ public class ACFollowStrategy extends AbstractFollowStrategy { ACDetailVO vo = assemble(followRecord.getCustomerId()); vo.setId(followRecord.getId()); vo.setTaskId(followRecord.getTaskId()); - vo.setHadCall(count > 0); + vo.setHadCall(count > 0 || !ValidationUtils.checkMobile(vo.getReportMobile())); vo.setDeadline(Objects.isNull(followRecord.getLimitTime()) ? followRecord.getDeadline() : followRecord.getLimitTime()); return vo; } -- libgit2 0.22.2