From 44c83542aa75ce0245573b8e4247794147a93802 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 12 四月 2023 01:46:01 +0800
Subject: [PATCH] 整合前端代码
---
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/StrategyServiceImpl.java | 42 +++++++++++++++++++++++++-----------------
1 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/StrategyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/StrategyServiceImpl.java
index 8673d59..d73d658 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/StrategyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/StrategyServiceImpl.java
@@ -81,23 +81,13 @@
if(!Func.isEmpty(dbstrategy)){
throw new ServiceException("璇ュ瘑鐮佺瓥鐣ュ凡瀛樺湪!");
}
+ //妫�楠屽瘑鐮佺瓥鐣ユ槸鍚︾鍚堣姹�
+ checkPwdStrategy(strategy);
//濡傛灉褰撳墠鏂板璁剧疆涓洪粯璁ゅ瘑鐮佺瓥鐣ワ紝闇�瑕佸皢宸插瓨鍦ㄩ粯璁ゅ瘑鐮佺瓥鐣ヤ慨鏀逛负闈為粯璁�
if(strategy.getIsDefault().equals("1") || strategy.getIsDefault() == 1){
this.update(Wrappers.<Strategy>update().lambda()
- .set(Strategy::getIsDefault, CommonConstant.NOT_SEALED_ID)
- .eq(Strategy::getIsDefault, CommonConstant.DATA_SCOPE_CATEGORY));
- }
- if(strategy.getRequiredType() > 0){
- throw new ServiceException("蹇呭~绉嶇被涓嶈兘灏忎簬绛変簬0!");
- }
- if(strategy.getRequiredType() > strategy.getCombinationIds().split(",").length){
- throw new ServiceException("蹇呭~绉嶇被涓嶈兘澶т簬鎵�閫夋嫨鐨勫瘑鐮佺粍鍚堟柟寮忕殑涓暟!");
- }
- if(strategy.getMaxPwdLen() > strategy.getMinPwdLen()){
- throw new ServiceException("瀵嗙爜鏈�澶ч暱搴︿笉鑳藉皬浜庢渶灏忛暱搴�!");
- }
- if(strategy.getMinPwdLen() < strategy.getCombinationIds().split(",").length || strategy.getMaxPwdLen() < strategy.getCombinationIds().split(",").length){
- throw new ServiceException("瀵嗙爜鏈�灏忛暱搴︿笉鑳藉皬浜庣瀵嗙瓥鐣ョ殑鍊�!");
+ .set(Strategy::getIsDefault, CommonConstant.NOT_DEFAULT)
+ .eq(Strategy::getIsDefault, CommonConstant.IS_DEFAULT));
}
if(Func.isEmpty(strategy.getCreateTime())){
strategy.setCreateTime(new Date());
@@ -108,11 +98,13 @@
boolean temp = super.saveOrUpdate(strategy);
return temp;
}else {
+ //妫�楠屽瘑鐮佺瓥鐣ユ槸鍚︾鍚堣姹�
+ checkPwdStrategy(strategy);
//濡傛灉褰撳墠淇敼璁剧疆涓洪粯璁ゅ瘑鐮佺瓥鐣ワ紝闇�瑕佸皢宸插瓨鍦ㄩ粯璁ゅ瘑鐮佺瓥鐣ヤ慨鏀逛负闈為粯璁�
if(strategy.getIsDefault().equals("1") || strategy.getIsDefault() == 1){
this.update(Wrappers.<Strategy>update().lambda()
- .set(Strategy::getIsDefault,CommonConstant.NOT_SEALED_ID)
- .eq(Strategy::getIsDefault,CommonConstant.DATA_SCOPE_CATEGORY));
+ .set(Strategy::getIsDefault,CommonConstant.NOT_DEFAULT)
+ .eq(Strategy::getIsDefault,CommonConstant.IS_DEFAULT));
}else {
if(Func.isEmpty(queryByIsDefault())){
throw new ServiceException("榛樿瀵嗙爜绛栫暐蹇呴』鏈変笖浠呮湁涓�鏉�!");
@@ -127,6 +119,22 @@
}
/**
+ * 妫�楠屽瘑鐮佺瓥鐣ユ槸鍚︾鍚堣姹�
+ * @param strategy
+ */
+ public void checkPwdStrategy(Strategy strategy){
+ if(strategy.getRequiredType() > strategy.getCombinationIds().split(",").length){
+ throw new ServiceException("蹇呭~绉嶇被涓嶈兘澶т簬鎵�閫夋嫨鐨勫瘑鐮佺粍鍚堟柟寮忕殑涓暟!");
+ }
+ if(strategy.getMaxPwdLen() < strategy.getMinPwdLen()){
+ throw new ServiceException("瀵嗙爜鏈�澶ч暱搴︿笉鑳藉皬浜庢渶灏忛暱搴�!");
+ }
+ if(strategy.getMinPwdLen() < strategy.getRequiredType() || strategy.getMaxPwdLen() < strategy.getRequiredType()){
+ throw new ServiceException("瀵嗙爜鏈�灏忛暱搴︿笉鑳藉皬浜庡繀濉绫荤殑鍊�!");
+ }
+ }
+
+ /**
* 閫氳繃涓婚敭鍒犻櫎鏁版嵁
*
* @param ids 涓婚敭
@@ -136,7 +144,7 @@
public boolean deleteByIds(List<String> ids) {
Strategy strategy = this.getOne(Wrappers.<Strategy>query().lambda()
.in(Strategy::getId,ids)
- .eq(Strategy::getIsDefault, CommonConstant.DATA_SCOPE_CATEGORY));
+ .eq(Strategy::getIsDefault, CommonConstant.IS_DEFAULT));
//濡傛灉瀛樺湪榛樿绛栫暐鐨刬d锛屽氨涓嶈兘鐩存帴鍒犻櫎缁欏嚭鎻愮ず
if(!Func.isEmpty(strategy)){
throw new ServiceException("涓嶈兘鍒犻櫎榛樿瀵嗙爜绛栫暐!");
--
Gitblit v1.9.3