From 8a23fdc23fc1b5edda31743de005a108fa1b7543 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期四, 14 三月 2019 09:42:37 +0800 Subject: [PATCH] 用户列表调整 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java index e990ed6..44ffd34 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java @@ -21,15 +21,16 @@ private ForbiddenUserIdentifyCodeMapper forbiddenUserIdentifyCodeMapper; @Override - public void addIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException { + public void forbiddenIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException { if (identifyCode == null || identifyCode.getType() == null || StringUtil.isNullOrEmpty(identifyCode.getIdentifyCode())) throw new ForbiddenUserIdentifyCodeException(1, "淇℃伅涓嶅畬鏁�"); ForbiddenUserIdentifyCode old = listByTypeAndIdentifyCode(identifyCode.getType(), identifyCode.getIdentifyCode()); - if (old != null) - throw new ForbiddenUserIdentifyCodeException(2, "淇℃伅宸插瓨鍦�"); + if (old != null) { + identifyCode.setId(old.getId()); + } identifyCode.setCreateTime(new Date()); identifyCode.setEffective(true); @@ -82,12 +83,9 @@ typeEnum = ForbiddenUserIdentifyCodeTypeEnum.alipayAccount; break; default: - break; + throw new ForbiddenUserIdentifyCodeException(1, "绫诲瀷涓嶅尮閰�"); } - if (typeEnum == null) { - throw new ForbiddenUserIdentifyCodeException(1, "绫诲瀷涓嶅尮閰�"); - } ForbiddenUserIdentifyCode codeObject = listByTypeAndIdentifyCode(typeEnum ,identifyCode); if (codeObject == null) { @@ -101,8 +99,17 @@ forbiddenUserIdentifyCodeMapper.insertSelective(codeObject); } else { - // 瑙e皝 - codeObject.setEffective(false); + + Boolean effective = codeObject.getEffective(); + if (effective) { + // 瑙e皝 + codeObject.setEffective(false); + } else { + // 灏佺 + codeObject.setEffective(true); + } + + codeObject.setUpdateTime(new Date()); forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(codeObject); } -- Gitblit v1.8.0