Browse Source

Merge remote-tracking branch 'origin/dev/one' into dev/one

wangyu 6 years ago
parent
commit
190b79d97b

+ 1 - 1
diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java

@@ -96,7 +96,7 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
         List<ProductService> psList = productServiceFacade.list(qwps);
         if (psList.size() > 0) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
-                    "该服务端正在使用,不允许删除,请先删除关联产品");
+                    "该服务端正在使用,不允许删除,请先删除关联产品");
         }
         serviceInfo.setIsDeleted(IsDeleteEnum.Y.getKey());
         this.updateById(serviceInfo);

+ 7 - 7
diagbotman-service/src/main/java/com/diagbot/facade/ServiceTokenFacade.java

@@ -69,30 +69,30 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
         if (TokenTypeEnum.Trial.getKey() == st.getType()) {
             ProductService ps = productServiceFacade.getById(st.getProductServiceId());
             if (ps == null) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
             }
             if (!ps.getProductId().equals(serviceTokenVo.getProductId())) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
             }
             Date date = new Date();
             if (st.getExpiringDate().getTime() < date.getTime()) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期");
             }
         } else {
             List<OpenedProducts> opList = openedProductsFacade.getByAppkeyAndSecret(paramMap);
             if (ListUtil.isEmpty(opList)) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
             }
             if (opList.size() != 1) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前appkey和secret对应多条数据!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前appkey和secret对应多条数据");
             }
             OpenedProducts op = opList.get(0);// 正常只有一条数据
             Date date = new Date();
             if (!(StatusEnum.Enable.getKey() == op.getServiceStatus())) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前服务已停用!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前服务已停用");
             }
             if (op.getEndTime().getTime() < date.getTime()) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期");
             }
         }
         return RespDTO.onSuc(true);

+ 1 - 1
uaa-service/src/main/java/com/diagbot/service/UrlUserService.java

@@ -42,7 +42,7 @@ public class UrlUserService implements UserDetailsService {
             user.setGrantedAuthorities(grantedAuthorities);
             return user;
         } else {
-            throw new UsernameNotFoundException("admin: " + userName + " do not exist!");
+            throw new UsernameNotFoundException("admin: " + userName + " do not exist");
         }
     }
 }

+ 1 - 0
user-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -39,6 +39,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/user/getUserAndOrg").permitAll()
                 .antMatchers("/user/getUserByOrgName").permitAll()
                 .antMatchers("/user/resetPassword").permitAll()
+                .antMatchers("/user/verifyUser").permitAll()
                 .antMatchers("/**").authenticated();
         //        .antMatchers("/**").permitAll();
     }

+ 1 - 1
user-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -83,7 +83,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/user/index", request)
                 || matchers("/user/getUserByOrgName", request)
                 || matchers("/user/getUserAndOrg", request)
-
+                || matchers("/user/verifyUser", request)
                 || matchers("/", request)) {
             return true;
         }

+ 11 - 11
user-service/src/main/java/com/diagbot/exception/ServiceErrorCode.java

@@ -8,17 +8,17 @@ package com.diagbot.exception;
  * @time: 2018/9/10 11:11
  */
 public enum ServiceErrorCode implements ErrorCode {
-    USER_NOT_FOUND("10020000", "该手机号暂未注册"),
-    USER_PASSWORD_ERROR("10020001", "手机号或密码不正确"),
-    GET_TOKEN_FAIL("10020002", "获取token失败"),
-    TOKEN_IS_NOT_MATCH_USER("10020003", "请使用自己的token进行接口请求"),
-
-    SMS_SEND_ERROR("10020004", "短信发送错误!"),
-    USER_BIND_ERROR("10020005", "用户手机号已经绑定无需再次验证!"),
-    USER_UN_BIND_ERROR("10020006", "用户手机号未绑定无需解绑!"),
-    VERIFYCODE_ERROR("10020007", "图片验证码生成错误!"),
-    USER_EXIST("10020008", "该手机已注册!"),
-    EMAIL_IS_NULL("10020009", "请输入邮箱");
+    USER_NOT_FOUND("10020000", "该手机号暂未注册"),
+    USER_PASSWORD_ERROR("10020001", "手机号或密码不正确"),
+    GET_TOKEN_FAIL("10020002", "获取token失败"),
+    TOKEN_IS_NOT_MATCH_USER("10020003", "请使用自己的token进行接口请求"),
+
+    SMS_SEND_ERROR("10020004", "短信发送错误"),
+    USER_BIND_ERROR("10020005", "用户手机号已经绑定无需再次验证"),
+    USER_UN_BIND_ERROR("10020006", "用户手机号未绑定无需解绑"),
+    VERIFYCODE_ERROR("10020007", "图片验证码生成错误"),
+    USER_EXIST("10020008", "该手机已注册"),
+    EMAIL_IS_NULL("10020009", "请输入邮箱");
 
     private String code;
     private String msg;

+ 1 - 1
user-service/src/main/java/com/diagbot/facade/PermissionFacade.java

@@ -37,7 +37,7 @@ public class PermissionFacade extends PermissionServiceImpl {
         }
         PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
         if (!passwordEncoder.matches(secret, user.getPassword())) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey 或 secret 错误【" + appkey + "," + secret + "】");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey 或 secret 错误【" + appkey + "," + secret + "】");
         }
         List<Permission> permissions = this.getPermissionByUserId(user.getId());
         return RespDTO.onSuc(permissions);

+ 38 - 16
user-service/src/main/java/com/diagbot/facade/UserFacade.java

@@ -59,12 +59,14 @@ import com.diagbot.vo.UserExportVO;
 import com.diagbot.vo.UserInfoAuditVO;
 import com.diagbot.vo.UserInfoOrganizationsVO;
 import com.diagbot.vo.UserSaveVO;
+import com.diagbot.vo.UsernameVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.factory.PasswordEncoderFactories;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.stereotype.Component;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Date;
@@ -72,8 +74,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.servlet.http.HttpServletResponse;
-
 /**
  * @Description: 用户业务层
  * @author: gaodm
@@ -120,7 +120,7 @@ public class UserFacade extends UserServiceImpl {
             throw new CommonException(ServiceErrorCode.USER_EXIST);
         }
         if (!RegexValidateUtil.checkMobileNumber(userSaveVO.getUsername())) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请输入正确的手机号!");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请输入正确的手机号");
         }
 
         //TODO 测试注释了图形验证和短信验证,后面要开启
@@ -143,6 +143,28 @@ public class UserFacade extends UserServiceImpl {
     }
 
 
+    /**
+     * 校验用户(手机号)是否注册
+     *
+     * @param usernameVO 参数
+     * @return 返回状态
+     */
+    public Boolean verifyUser(UsernameVO usernameVO) {
+        String username = usernameVO.getUsername();
+        if(StringUtil.isEmpty(username)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请输入手机号");
+        }
+        if(!RegexValidateUtil.checkMobileNumber(username)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请输入正确的手机号");
+        }
+        User bean = findByName(username);
+        if (bean != null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该手机已注册");
+        }
+        return true;
+    }
+
+
     /**
      * @param page       分页参数
      * @param userSaveVO 参数
@@ -205,13 +227,13 @@ public class UserFacade extends UserServiceImpl {
             orgId = org.getId();
         } else {
             orgId = list.get(0).getId();
-            //查询机构下是否已存在用户信息,如已存在,就抛异常,需求核实
+            //查询机构下是否已存在用户信息,如已存在,就抛异常,需求核实2018.10.16
             Map paramMap1 = new HashMap();
             paramMap1.put("organization_id", orgId);
             paramMap1.put("is_deleted", IsDeleteEnum.N.getKey());
             List<UserOrganization> res1 = userOrganizationFacade.selectByMap(paramMap1);
             if (ListUtil.isNotEmpty(res1)) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该机构下已存在用户,不能再添加别的用户");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该机构下已存在用户,不能再添加别的用户");
             }
         }
 
@@ -320,11 +342,11 @@ public class UserFacade extends UserServiceImpl {
         JwtDTO data = new JwtDTO();
         if (StringUtil.isBlank(username)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入手机号!");
+                    "请输入手机号");
         }
         if (StringUtil.isBlank(password)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入密码!");
+                    "请输入密码");
         }
         User user = this.findByName(username);
         if (null == user) {
@@ -355,7 +377,7 @@ public class UserFacade extends UserServiceImpl {
         JwtDTO data = new JwtDTO();
         if (StringUtil.isBlank(refreshToken)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "刷新令牌不能为空!");
+                    "刷新令牌不能为空");
         }
 
         JWT jwt = authServiceClient.refreshToken("Basic dWFhLXNlcnZpY2U6MTIzNDU2", "refresh_token", refreshToken);
@@ -377,7 +399,7 @@ public class UserFacade extends UserServiceImpl {
     public OAuth2AccessToken checkToken(String token) {
         if (StringUtil.isBlank(token)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "令牌不能为空!");
+                    "令牌不能为空");
         }
 
         OAuth2AccessToken jwt = authServiceClient.checkToken("Basic dWFhLXNlcnZpY2U6MTIzNDU2", token);
@@ -465,11 +487,11 @@ public class UserFacade extends UserServiceImpl {
     public RespDTO resetPassword(String username, String password, String diffPassword) {
         if (StringUtil.isBlank(username)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入手机号!");
+                    "请输入手机号");
         }
         if (StringUtil.isBlank(password)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入密码!");
+                    "请输入密码");
         }
         User user = this.findByName(username);
         if (null == user) {
@@ -478,7 +500,7 @@ public class UserFacade extends UserServiceImpl {
         PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
         if (!StringUtil.isBlank(diffPassword) && "Y".equals(diffPassword)) {
             if (passwordEncoder.matches(password, user.getPassword())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "修改后密码不能与修改前相同!");
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "修改后密码不能与修改前相同");
             }
         }
         String entryPassword = passwordEncoder.encode(password);
@@ -499,15 +521,15 @@ public class UserFacade extends UserServiceImpl {
     public Boolean modifyPassword(String password, String modifyPassword) {
         if (StringUtil.isBlank(password)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入密码!");
+                    "请输入密码");
         }
         if (StringUtil.isBlank(modifyPassword)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入新密码!");
+                    "请输入新密码");
         }
         if(password.equals(modifyPassword)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "原密码和新密码不能相同!");
+                    "原密码和新密码不能相同");
         }
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         User user = this.getById(userId);
@@ -518,7 +540,7 @@ public class UserFacade extends UserServiceImpl {
 
         PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
         if (!passwordEncoder.matches(password, user.getPassword())) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "原密码错误");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "原密码错误");
         }
 
         String entryPassword = passwordEncoder.encode(modifyPassword);

+ 22 - 22
user-service/src/main/java/com/diagbot/facade/VerFacade.java

@@ -77,19 +77,19 @@ public class VerFacade {
         //参数验证
         if (StringUtil.isBlank(smsVerCreatVO.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码唯一标志不能为空!");
+                    "图片验证码唯一标志不能为空");
         }
         if (StringUtil.isBlank(smsVerCreatVO.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码不能为空!");
+                    "图片验证码不能为空");
         }
         if (StringUtil.isBlank(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户电话不能为空!");
+                    "用户电话不能为空");
         }
         if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "请输入正确的手机号!");
+                    "请输入正确的手机号");
         }
         //验证图片验证码
         ImgVerInfo imgVerInfo = new ImgVerInfo();
@@ -98,7 +98,7 @@ public class VerFacade {
         if (imgVerRes) {
             User bean = userFacade.getUserInfo(smsVerCreatVO.getMobile());
             if (bean != null) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册");
             }
 
             //验证是否超过三分钟
@@ -107,11 +107,11 @@ public class VerFacade {
                 if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), ConstantEnum.SMS_EXPIRED_INTERVAL.getKey()),
                         DateUtil.now())) {
                     throw new CommonException(ServiceErrorCode.SMS_SEND_ERROR,
-                            "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送!");
+                            "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送");
                 }
             }
         } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误");
         }
 
         //发送短信
@@ -136,23 +136,23 @@ public class VerFacade {
         //参数验证
         if (StringUtil.isBlank(smsVerCreatVO.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码唯一标志不能为空!");
+                    "图片验证码唯一标志不能为空");
         }
         if (StringUtil.isBlank(smsVerCreatVO.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码不能为空!");
+                    "图片验证码不能为空");
         }
         if (StringUtil.isBlank(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户电话不能为空!");
+                    "用户电话不能为空");
         }
         if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "请输入正确的手机号!");
+                    "请输入正确的手机号");
         }
         User bean = userFacade.getUserInfo(smsVerCreatVO.getMobile());
         if (bean == null) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "手机号未注册!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "手机号未注册");
         }
 
         //验证是否超过三分钟
@@ -161,7 +161,7 @@ public class VerFacade {
             if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), ConstantEnum.SMS_EXPIRED_INTERVAL.getKey()),
                     DateUtil.now())) {
                 throw new CommonException(ServiceErrorCode.SMS_SEND_ERROR,
-                        "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送!");
+                        "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送");
             }
         }
 
@@ -187,27 +187,27 @@ public class VerFacade {
         //参数验证
         if (null == smsVerVerVO) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "短信验证码验证输入信息不能为空!");
+                    "短信验证码验证输入信息不能为空");
         }
         //        if (StringUtil.isBlank(smsVerVerVO.getImgId())){
         //            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-        //                    "图片验证码唯一标志不能为空!");
+        //                    "图片验证码唯一标志不能为空");
         //        }
         //        if (StringUtil.isBlank(smsVerVerVO.getCode())){
         //            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-        //                    "图片验证码不能为空!");
+        //                    "图片验证码不能为空");
         //        }
         if (StringUtil.isBlank(smsVerVerVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户电话不能为空!");
+                    "用户电话不能为空");
         }
         if (StringUtil.isBlank(smsVerVerVO.getSmsCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "短信验证码不能为空!");
+                    "短信验证码不能为空");
         }
         if (!RegexValidateUtil.checkMobileNumber(smsVerVerVO.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "请输入正确的手机号!");
+                    "请输入正确的手机号");
         }
         //验证图片验证码
         //        ImgVerInfo imgVerInfo = new ImgVerInfo();
@@ -216,10 +216,10 @@ public class VerFacade {
         //        if (imgVerRes){
         //            User bean = userFacade.getUserInfo(smsVerVerVO.getMobile());
         //            if (bean != null){
-        //                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
+        //                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册");
         //            }
         //        } else {
-        //            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
+        //            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误");
         //        }
         //验证用户短信信息
         SwsVerInfo swsVerInfo = new SwsVerInfo();
@@ -227,7 +227,7 @@ public class VerFacade {
         swsVerInfo.setCode(smsVerVerVO.getSmsCode());
         Boolean smsVer = smsVerService.verifySmsVerification(swsVerInfo);
         if (!smsVer) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "短信验证码输入有误,请重新输入!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "短信验证码输入有误,请重新输入");
         }
         return true;
     }

+ 10 - 10
user-service/src/main/java/com/diagbot/service/impl/ImgVerServiceImpl.java

@@ -59,11 +59,11 @@ public class ImgVerServiceImpl implements ImgVerService {
     public byte[] createImgVerification(ImgVerInfo imgVerInfo) {
         if (null == imgVerInfo) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户图片验证信息不能为空!");
+                    "用户图片验证信息不能为空");
         }
         if (StringUtil.isBlank(imgVerInfo.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码唯一标志不能为空!");
+                    "图片验证码唯一标志不能为空");
         }
         //生成图片验证码
         Object[] obj = VerifyCodeUtils.createImage();
@@ -101,15 +101,15 @@ public class ImgVerServiceImpl implements ImgVerService {
     public Boolean verifyImgVerification(ImgVerInfo imgVerInfo) {
         if (null == imgVerInfo) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户图片验证信息不能为空!");
+                    "用户图片验证信息不能为空");
         }
         if (StringUtil.isBlank(imgVerInfo.getImgId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "图片验证码唯一标志不能为空!");
+                    "图片验证码唯一标志不能为空");
         }
         if (StringUtil.isBlank(imgVerInfo.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "验证码不能为空!");
+                    "验证码不能为空");
         }
         //从redis中取出
         final byte[] redis_key = getUserImgKey(imgVerInfo.getImgId());
@@ -124,26 +124,26 @@ public class ImgVerServiceImpl implements ImgVerService {
             }
         });
         if (imgVerInfoRes == null) {
-            log.info("用户图片验证信息不存在【imgId=" + imgVerInfo.getImgId() + "】!");
+            log.info("用户图片验证信息不存在【imgId=" + imgVerInfo.getImgId() + "】");
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "用户图片验证信息不存在【imgId=" + imgVerInfo.getImgId() + "】!");
+                    "用户图片验证信息不存在【imgId=" + imgVerInfo.getImgId() + "】");
         }
         //判断是否是想要的对象
         if (!imgVerInfoRes.getImgId().equals(imgVerInfo.getImgId())) {
             log.info("图片验证码唯一标志不一致!图片验证码唯一标志:{}", imgVerInfo.getImgId());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "图片验证码唯一标志不一致!");
+                    "图片验证码唯一标志不一致");
         }
         if (!(imgVerInfoRes.getCode()).equals(imgVerInfo.getCode().toUpperCase())) {
             log.info("输入图形验证码有误!验证码:{}", imgVerInfo.getCode());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "输入图形验证码有误!");
+                    "输入图形验证码有误");
         }
         //判断是否过期
         if (!DateUtil.after(imgVerInfoRes.getExpireTime(), DateUtil.now())) {
             log.info("图片验证码已过期,请重新获取!过期时间:{}", imgVerInfoRes.getExpireTime());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "图片验证码已过期,请重新获取!");
+                    "图片验证码已过期,请重新获取");
         }
         return true;
     }

+ 11 - 11
user-service/src/main/java/com/diagbot/service/impl/SmsVerServiceImpl.java

@@ -60,7 +60,7 @@ public class SmsVerServiceImpl implements SmsVerService {
     public String smsSend(String mobile, String smsTemplateCode) {
         if (StringUtil.isBlank(mobile)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "电话号码不能为空!");
+                    "电话号码不能为空");
         }
 
         //组装请求对象-具体描述见控制台-文档部分内容
@@ -103,15 +103,15 @@ public class SmsVerServiceImpl implements SmsVerService {
     public Boolean createSmsVerification(SwsVerInfo swsVerInfo) {
         if (null == swsVerInfo) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户短信验证信息不能为空!");
+                    "用户短信验证信息不能为空");
         }
         if (StringUtil.isBlank(swsVerInfo.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户电话不能为空!");
+                    "用户电话不能为空");
         }
         if (StringUtil.isBlank(swsVerInfo.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "验证码不能为空!");
+                    "验证码不能为空");
         }
         swsVerInfo.setCreateTime(DateUtil.now());
         final Date expireDate = DateUtil.addMinutes(DateUtil.now(),  ConstantEnum.SMS_EXPIRED_INTERVAL.getKey());
@@ -146,15 +146,15 @@ public class SmsVerServiceImpl implements SmsVerService {
     public Boolean verifySmsVerification(SwsVerInfo swsVerInfo) {
         if (null == swsVerInfo) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户短信验证信息不能为空!");
+                    "用户短信验证信息不能为空");
         }
         if (StringUtil.isBlank(swsVerInfo.getMobile())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "用户电话不能为空!");
+                    "用户电话不能为空");
         }
         if (StringUtil.isBlank(swsVerInfo.getCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "短信验证码不能为空!");
+                    "短信验证码不能为空");
         }
         //从redis中取出
         final byte[] redis_key = getUserSmsKey(swsVerInfo.getMobile());
@@ -171,24 +171,24 @@ public class SmsVerServiceImpl implements SmsVerService {
         if (swsVerInfoRes == null) {
             log.info("用户短信验证信息不存在!用户电话:{}", swsVerInfo.getMobile());
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "用户短信验证信息不存在!");
+                    "用户短信验证信息不存在");
         }
         //判断是否是想要的对象
         if (!swsVerInfoRes.getMobile().equals(swsVerInfo.getMobile())) {
             log.info("用户电话不一致! 用户电话:{}", swsVerInfo.getMobile());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "用户电话不一致!");
+                    "用户电话不一致");
         }
         if (!swsVerInfoRes.getCode().equals(swsVerInfo.getCode())) {
             log.info("短信验证码输入有误!用户电话:{},验证码:{}", swsVerInfo.getMobile(), swsVerInfo.getCode());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "短信验证码输入有误!");
+                    "短信验证码输入有误");
         }
         //判断是否过期
         if (!DateUtil.after(swsVerInfoRes.getExpireTime(), DateUtil.now())) {
             log.info("短息验证码已过期,请重新获取!用户电话:{},过期时间:{}", swsVerInfo.getMobile(), swsVerInfoRes.getExpireTime());
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "短息验证码已过期,请重新获取!");
+                    "短息验证码已过期,请重新获取");
         }
         return true;
     }

+ 4 - 4
user-service/src/main/java/com/diagbot/vo/OrganizationVO.java

@@ -18,22 +18,22 @@ public class OrganizationVO {
     /**
      * 机构名称
      */
-    @NotBlank(message = "请输入机构名称!")
+    @NotBlank(message = "请输入机构名称")
     private String organizationName;
     /**
      * 机构类型
      */
-    @NotNull(message = "请输入机构类型!")
+    @NotNull(message = "请输入机构类型")
     private Integer type;
     /**
      * 负责人
      */
-    @NotBlank(message = "请输入机构负责人!")
+    @NotBlank(message = "请输入机构负责人")
     private String principal;
     /**
      * 机构地址
      */
-    @NotBlank(message = "请输入机构地址!")
+    @NotBlank(message = "请输入机构地址")
     private String address;
     /**
      * 下属机构数量

+ 4 - 4
user-service/src/main/java/com/diagbot/vo/UserAndOrganizationVO.java

@@ -19,7 +19,7 @@ public class UserAndOrganizationVO {
     /**
      * 机构id
      */
-    @NotNull(message = "请输入机构id!")
+    @NotNull(message = "请输入机构id")
     private Long organizationid;
 
     /**
@@ -37,19 +37,19 @@ public class UserAndOrganizationVO {
     /**
      * 联系人
      */
-    @NotBlank(message = "请输入联系人!")
+    @NotBlank(message = "请输入联系人")
     private String linkman;
 
     /**
      * 邮箱
      */
-    @NotBlank(message = "请输入邮箱!")
+    @NotBlank(message = "请输入邮箱")
     private String email;
 
     /**
      * 岗位信息
      */
-    @NotBlank(message = "请输入岗位信息!")
+    @NotBlank(message = "请输入岗位信息")
     private String position;
 
 }

+ 2 - 2
user-service/src/main/java/com/diagbot/vo/UserAuthenticationVO.java

@@ -13,10 +13,10 @@ import javax.validation.constraints.NotBlank;
 @Getter
 @Setter
 public class UserAuthenticationVO {
-    @NotBlank(message = "请输入手机号!")
+    @NotBlank(message = "请输入手机号")
     private String username;
     private String position;
-    @NotBlank(message = "请输入机构名称!")
+    @NotBlank(message = "请输入机构名称")
     private String organization;
     private String organizationPrincipal;
     private String organizationAddress;

+ 1 - 1
user-service/src/main/java/com/diagbot/vo/UserInfoAuditVO.java

@@ -19,7 +19,7 @@ public class UserInfoAuditVO {
     private Integer rejectType;//未通过类型
     private String rejectComment;//认证被拒理由
     private Integer status;//认证状态(0:未认证,1:已认证,2:认证中)
-    @NotNull(message = "请输入用户id!")
+    @NotNull(message = "请输入用户id")
     private Long userId;//用户id
 
 }

+ 5 - 5
user-service/src/main/java/com/diagbot/vo/UserInfoVO.java

@@ -15,15 +15,15 @@ import javax.validation.constraints.Pattern;
 @Setter
 public class UserInfoVO {
 
-    @NotBlank(message = "请输入密码!")
+    @NotBlank(message = "请输入密码")
     @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$", message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
     private String password;
-    @NotBlank(message = "请输入手机号!")
+    @NotBlank(message = "请输入手机号")
     private String username;
-    @NotBlank(message = "请输入机构名称!")
+    @NotBlank(message = "请输入机构名称")
     private String organization;
-    @NotBlank(message = "请输入联系人姓名!")
+    @NotBlank(message = "请输入联系人姓名")
     private String linkman;
-    @NotBlank(message = "请输入邮箱!")
+    @NotBlank(message = "请输入邮箱")
     private String email; //邮箱
 }

+ 7 - 7
user-service/src/main/java/com/diagbot/vo/UserSaveVO.java

@@ -15,21 +15,21 @@ import javax.validation.constraints.Pattern;
 @Setter
 public class UserSaveVO {
 
-    @NotBlank(message = "请输入密码!")
+    @NotBlank(message = "请输入密码")
     @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$", message = "密码必须数字和字母组成,并且要同时含有数字和字母,且长度要在6-16位之间")
     private String password;
-    @NotBlank(message = "请输入手机号!")
+    @NotBlank(message = "请输入手机号")
     private String username;
-    @NotBlank(message = "请输入机构名称!")
+    @NotBlank(message = "请输入机构名称")
     private String organization;
-    @NotBlank(message = "请输入联系人姓名!")
+    @NotBlank(message = "请输入联系人姓名")
     private String linkman;
-    @NotBlank(message = "请输入邮箱!")
+    @NotBlank(message = "请输入邮箱")
     private String email; //邮箱
     //图片验证码唯一标志
-    @NotBlank(message = "图片验证码唯一标志不能为空!")
+    @NotBlank(message = "图片验证码唯一标志不能为空")
     private String imgId;
     //验证码
-    @NotBlank(message = "请输入图形验证码!")
+    @NotBlank(message = "请输入图形验证码")
     private String code;
 }

+ 11 - 0
user-service/src/main/java/com/diagbot/web/UserController.java

@@ -54,6 +54,7 @@ public class UserController {
     @Autowired
     private PermissionFacade permissionFacade;
 
+
     @ApiOperation(value = "注册[by:zhoutg]",
             notes = "username:用户名,必填<br>" +
                     "password:密码,必填<br> " +
@@ -71,6 +72,16 @@ public class UserController {
     }
 
 
+    @ApiOperation(value = "校验用户(手机号)是否注册[by:zhoutg]",
+            notes = "username:用户名(手机号),必填<br>")
+    @PostMapping("/verifyUser")
+    @SysLogger("verifyUser")
+    public RespDTO<Boolean> verifyUser(@RequestBody UsernameVO usernameVO) {
+        Boolean res = userFacade.verifyUser(usernameVO);
+        return RespDTO.onSuc(res);
+    }
+
+
     @ApiOperation(value = "登录获取jwt[by:zhoutg]",
             notes = "username:用户名,必填<br>" +
                     "password:密码, 必填<br> ")