From 1da17d215d48e3e3aa9e8d7a3ef526904764f408 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 08 四月 2019 14:06:12 +0800
Subject: [PATCH] 1.5.3部分需求 提交
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java | 26 +++++++++++++++++---------
1 files changed, 17 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 7f9ead2..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,16 +83,13 @@
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) {
- // 灏佺璐︽埛
+ // 灏佺
codeObject = new ForbiddenUserIdentifyCode();
codeObject.setType(typeEnum);
codeObject.setIdentifyCode(identifyCode);
@@ -101,7 +99,17 @@
forbiddenUserIdentifyCodeMapper.insertSelective(codeObject);
} else {
- 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