Source/plt-web/plt-web-parent/plt-web-base/pom.xml
@@ -46,6 +46,11 @@ <artifactId>hutool-all</artifactId> <version>5.4.3</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> </dependencies> </project> Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/TokenKeyConstant.java
@@ -37,4 +37,38 @@ */ public static final String REQUEST_TIMESTAMP = "vciHttpStartRequestTime"; /** * ç¨æ·è®¸å¯å¨rediséçåç¼ */ public static final String TOKEN_KEY_PREFIX_IN_REDIS = "jwt-token:"; /** * 令çç§é¥ */ public static final String SECRET = "thisissecretforjwt"; /** * JWTä¸çç¨æ·ä¸»é®çKey */ public static final String JWT_USER_KEY = "user_key"; /** * JWTä¸tokençkey */ public static final String JWT_TOKEN_KEY = "token_key"; /** * JWTä¸ç¨æ·è´¦å·çkey */ public static final String JWT_USER_CODE_KEY = "user_code_key"; /** * JWTä¸ç¨æ·ååkey */ public static final String JWT_USER_NAME_KEY = "user_name_key"; /** * ç¼åæææï¼é»è®¤30ï¼åéï¼ */ public static final long EXPIRATION = 30; } Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/TokenVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,52 @@ package com.vci.starter.web.pagemodel; /** * @Description 许å¯çæ¾ç¤ºä¿¡æ¯ * @Author dangsn * @Date 2024/6/6 17:37 */ public class TokenVO { /** * åºåå */ private static final long serialVersionUID = -1067382417908970897L; /** * tokençå¼ */ private String accessToken; /** * æææ */ private Long expireTime; /** * æ¯å¦è·åææºå·,为trueçæ¶å表示éè¦ææºå· */ private Boolean phoneFlag; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public Long getExpireTime() { return expireTime; } public void setExpireTime(Long expireTime) { this.expireTime = expireTime; } public Boolean getPhoneFlag() { return phoneFlag; } public void setPhoneFlag(Boolean phoneFlag) { this.phoneFlag = phoneFlag; } } Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/JwtUtils.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,135 @@ package com.vci.starter.web.util; import cn.hutool.core.convert.Convert; import com.vci.starter.web.constant.TokenKeyConstant; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import java.util.Map; /** * @Description Jwtå·¥å ·ç±» * @Author dangsn * @Date 2024/6/6 17:32 */ public class JwtUtils { /** * 仿°æ®å£°æçæä»¤ç * * @param claims æ°æ®å£°æ * @return 令ç */ public static String createToken(Map<String, Object> claims) { String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, TokenKeyConstant.SECRET).compact(); return token; } /** * ä»ä»¤çä¸è·åæ°æ®å£°æ * * @param token 令ç * @return æ°æ®å£°æ */ public static Claims parseToken(String token) { return Jwts.parser().setSigningKey(TokenKeyConstant.SECRET).parseClaimsJws(token).getBody(); } /** * 使ç¨jwtçtokenè·åå¨rediséåå¨çtoken * @param token jwtçè®¸å¯ * @return rediséçtokenå¼ */ public static final String getUserToken(String token){ Claims claims = parseToken(token); return getValue(claims, TokenKeyConstant.JWT_TOKEN_KEY); } /** * 使ç¨jwtçæ°æ®å¯¹è±¡è·årediséåå¨çtoken * @param claims 对象 * @return rediséçtokenå¼ */ public static final String getUserToken(Claims claims){ return getValue(claims, TokenKeyConstant.JWT_TOKEN_KEY); } /** * æ ¹æ®ä»¤çè·åç¨æ·æ è¯ * * @param token 令ç * @return ç¨æ·ID */ public static String getUserKey(String token) { Claims claims = parseToken(token); return getValue(claims, TokenKeyConstant.JWT_USER_KEY); } /** * æ ¹æ®ä»¤çè·åç¨æ·æ è¯ * * @param claims èº«ä»½ä¿¡æ¯ * @return ç¨æ·ID */ public static String getUserKey(Claims claims) { return getValue(claims, TokenKeyConstant.JWT_USER_KEY); } /** * æ ¹æ®ä»¤çè·åç¨æ·ID * * @param token 令ç * @return ç¨æ·ID */ public static String getUserId(String token) { Claims claims = parseToken(token); return getValue(claims, TokenKeyConstant.JWT_USER_KEY); } /** * æ ¹æ®èº«ä»½ä¿¡æ¯è·åç¨æ·ID * * @param claims èº«ä»½ä¿¡æ¯ * @return ç¨æ·ID */ public static String getUserId(Claims claims) { return getValue(claims, TokenKeyConstant.JWT_USER_KEY); } /** * æ ¹æ®ä»¤çè·åç¨æ·å * * @param token 令ç * @return ç¨æ·å */ public static String getUserCode(String token) { Claims claims = parseToken(token); return getValue(claims, TokenKeyConstant.JWT_USER_CODE_KEY); } /** * æ ¹æ®èº«ä»½ä¿¡æ¯è·åç¨æ·å * * @param claims èº«ä»½ä¿¡æ¯ * @return ç¨æ·å */ public static String getUserCode(Claims claims) { return getValue(claims, TokenKeyConstant.JWT_USER_CODE_KEY); } /** * æ ¹æ®èº«ä»½ä¿¡æ¯è·åé®å¼ * * @param claims èº«ä»½ä¿¡æ¯ * @param key é® * @return å¼ */ public static String getValue(Claims claims, String key) { return Convert.toStr(claims.get(key), ""); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java
@@ -23,17 +23,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheKeyConstant.ALL_FUNCTION; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * èå¹³å°çæéæå¡ @@ -94,7 +89,6 @@ * @return åè½çæ¾ç¤ºå¯¹è±¡ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = ALL_FUNCTION,unless = "#result == null") public Map<String, SmFunctionVO> selectAllFunctionMap() { return Optional.ofNullable(self.selectAllFunction()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t)); } @@ -678,7 +672,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = ALL_FUNCTION) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java
@@ -14,8 +14,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -25,8 +23,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import static com.vci.web.constant.CacheNameConstant.VCI_SESSION; /** * ä¼è¯åå¨çæå¡ @@ -155,7 +151,6 @@ * @return ç¨æ·ä¼è¯å¯¹è±¡ */ @Override @Cacheable(value = VCI_SESSION,key = "#p0",unless = "#target == null") public SessionInfo getSessionInfoByToken(String userToken) { WebUtil.alertNotNull(userToken,"许å¯çä¿¡æ¯"); List<Map> dataList = boService.queryBySqlForMap("select JSONSTRING as JSONSTRING from VCI_SESSIONINFO where TOKEN ='" + userToken.trim() + "'", new HashMap<>()); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -22,7 +22,6 @@ import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -31,7 +30,6 @@ import java.util.stream.Collectors; import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; import static com.vci.web.constant.CacheNameConstant.VCI_USER; import static com.vci.web.util.WebUtil.arryAndSqlToClientBusinessObject; /** @@ -95,7 +93,6 @@ * @throws VciBaseException åæ°ä¸ºç©ºæè æ°æ®åºåå¨é®é¢çæ¶å伿åºå¼å¸¸ */ @Override @Cacheable(value = VCI_USER,key = "#p0",unless = "#result == null") public SmUserVO getUserByUserId(String userId) throws VciBaseException { WebUtil.alertNotNull(userId,"ç¨æ·å"); return getUserByField("plusername",userId); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/constant/FrameWorkBusLangCodeConstant.java
@@ -105,6 +105,11 @@ */ public static final String PASSWORD_REMAIN_DAY = "passwordRemainDay"; /** * å¯ç å·²è¿æ */ public static final String PASSWORD_EXPIRE = "passwordExpire"; //ç»ç» @@ -516,4 +521,23 @@ */ public static final String DISPATCH_TASK_NOT_EXIST_BY_PLAN = "dispatchTaskNotExistByPlan"; /** * ç³»ç»å¼å¸¸ */ public static final String SYSTEM_ERROR = "systemError"; /** * ç»å½æå */ public static final String LOGIN_SUCCESS = "loginSuccess"; /** * åå§å¯ç éè¦ä¿®æ¹ */ public static final String PASSWORD_INIT = "passwordInit"; /** * å¯ç çç¥å·²ç»ä¿®æ¹ï¼éä¿®æ¹è´¦å·å¯ç */ public static final String PASSWORD_POLICY_UPDATED = "passwordPolicyUpdated"; } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java
@@ -146,6 +146,11 @@ */ private String photo; /** * tokenå¼ */ private String token; @Override public String getId() { return id; @@ -357,11 +362,18 @@ this.photo = photo; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } @Override public String toString() { return "SmUserVO{" + "oid='" + getOid() + '\'' + ",id='" + id + '\'' + "id='" + id + '\'' + ", name='" + name + '\'' + ", userType='" + userType + '\'' + ", userTypeText='" + userTypeText + '\'' + @@ -385,9 +397,9 @@ ", sexText='" + sexText + '\'' + ", langCode='" + langCode + '\'' + ", langCodeText='" + langCodeText + '\'' + ", lockFlag='" + lockFlag + '\'' + ", lockFlag=" + lockFlag + ", photo='" + photo + '\'' + ",description='" + getDescription() + '\'' + ", token='" + token + '\'' + '}'; } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/constant/CacheKeyConstant.java
ÎļþÒÑɾ³ý Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/constant/CacheNameConstant.java
@@ -8,6 +8,82 @@ public class CacheNameConstant { /** * ææç屿§ */ public static final String ALL_STATUS = "allStatus"; /** * ææçä¸å¡ç±»å */ public static final String ALL_BTM = "allBtm"; /** * ææçæä¸¾ */ public static final String ALL_ENUM = "allEnum"; /** * ææçå½å¨æ */ public static final String ALL_LIFE_CYCLE = "allLife"; /** * ææç龿¥å ³ç³» */ public static final String ALL_Link = "allLink"; /** * ææççæ¬è§å */ public static final String ALL_REVISION = "allRevisionRule"; /** * ææçåè½ */ public static final String ALL_FUNCTION = "allFunction"; /** * ææç屿§ */ public static final String ALL_ATTRIBUTE = "allAttribute"; /** * ææçUIåºå */ public static final String ALL_LAYOUT = "allLayout" ; /** * ææç表ååè¡¨æ ¼ */ public static final String ALL_FORM_AND_TABLE = "allFormAndTable"; /** * ææç表å */ public static final String ALL_FORM = "allForm"; /** * ææçè¡¨æ ¼ */ public static final String ALL_TABLE = "allTable"; /** * ææçaction */ public static final String ALL_ACTION = "allAction"; /** * ææçUI */ public static final String ALL_UI = "allUI"; /** * ææçç»ä»¶ */ public static final String ALL_COMP = "allComp"; /** * ä¼è¯çä¿¡æ¯ */ public static final String VCI_SESSION = "vci_session_cache"; @@ -20,5 +96,29 @@ /** * ç¨æ· */ public static final String VCI_USER = "VCI_USER"; public static final String VCI_USER = "vci_user:"; /** * ç¨æ·å¯ä¸æ è¯ */ public static final String VCI_USER_OID = "vci_user_oid:"; /** * ç¨æ· */ public static final String VCI_USER_LOGIN = "vci_user_login:"; /** * è¿åæ¼æ¥åçkey * * @param cacheKey ç¼åkey * @param cacheKeyValue ç¼åkeyå¼ * @return tenantKey */ public static String cacheKey(String cacheKey, String cacheKeyValue) { if(cacheKeyValue == null){ cacheKeyValue = ""; } return cacheKey.concat(cacheKeyValue); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/initTask/VciWebInitTaskComponent.java
@@ -143,7 +143,7 @@ // secretService.getMinDataSecret(); // secretService.getMinIpSecret(); // secretService.getMinUserSecret(); initService.clearAllCache(); // initService.clearAllCache(); // initService.initServerCache(); mdService.scanAllMdFile(); initDefaultAttribute(); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisConfig.java
@@ -20,8 +20,8 @@ * @author wang1 */ @Configuration @ConditionalOnProperty(value = "spring.redis.enabled",havingValue = "true",matchIfMissing = false) @EnableCaching @ConditionalOnProperty(value = "spring.redis.enabled",havingValue = "true",matchIfMissing = false) public class RedisConfig extends CachingConfigurerSupport { @Bean Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java
@@ -1,25 +1,28 @@ package com.vci.web.redis; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.geo.Distance; import org.springframework.data.geo.Metrics; import org.springframework.data.geo.Point; import org.springframework.data.redis.core.*; import org.springframework.data.redis.core.script.DefaultRedisScript; import org.springframework.data.redis.core.script.RedisScript; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.stereotype.Component; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; /** * spring redis å·¥å ·ç±» * * @author wang1 * @author dangsn **/ @SuppressWarnings(value = { "unchecked", "rawtypes" }) @Component @Slf4j public class RedisService { @Autowired(required = false) @@ -31,8 +34,7 @@ * @param key ç¼åçé®å¼ * @param value ç¼åçå¼ */ public <T> void setCacheObject(final String key, final T value) { public <T> void setCacheObject(final String key, final T value) { redisTemplate.opsForValue().set(key, value); } @@ -44,8 +46,7 @@ * @param timeout æ¶é´ * @param timeUnit æ¶é´é¢ç²åº¦ */ public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) { public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) { redisTemplate.opsForValue().set(key, value, timeout, timeUnit); } @@ -69,8 +70,7 @@ * @param unit æ¶é´åä½ * @return true=设置æåï¼false=设置失败 */ public boolean expire(final String key, final long timeout, final TimeUnit unit) { public boolean expire(final String key, final long timeout, final TimeUnit unit) { return redisTemplate.expire(key, timeout, unit); } @@ -91,8 +91,7 @@ * @param key é® * @return true åå¨ falseä¸åå¨ */ public Boolean hasKey(String key) { public Boolean hasKey(String key) { return redisTemplate.hasKey(key); } @@ -102,8 +101,7 @@ * @param key ç¼åé®å¼ * @return ç¼åé®å¼å¯¹åºçæ°æ® */ public <T> T getCacheObject(final String key) { public <T> T getCacheObject(final String key) { ValueOperations<String, T> operation = redisTemplate.opsForValue(); return operation.get(key); } @@ -111,7 +109,8 @@ /** * å é¤å个对象 * * @param key * @param key å¯ä»¥ * @return å 餿¯å¦æå */ public boolean deleteObject(final String key) { @@ -122,7 +121,7 @@ * å é¤éå对象 * * @param collection å¤ä¸ªå¯¹è±¡ * @return * @return å é¤çä¸ªæ° */ public long deleteObject(final Collection collection) { @@ -130,50 +129,14 @@ } /** * listçé¿åº¦ * * @param key ç¼åçé®å¼ * @return ç¼åç对象 */ public <T> Long listSize(final String key) { return redisTemplate.opsForList().size(key); } /** * ä»å·¦è¾¹ååºä¸ä¸ªlistå ç´ * * @param key ç¼åçé®å¼ * @return ç¼åç对象 */ public <T> Object leftPop(final String key) { return redisTemplate.opsForList().leftPop(key); } /** * ä»å³è¾¹ç¼åListæ°æ® * ç¼åListæ°æ® * * @param key ç¼åçé®å¼ * @param dataList å¾ ç¼åçListæ°æ® * @return ç¼åç对象 */ public <T> long setCacheList(final String key, final List<T> dataList) { public <T> long setCacheList(final String key, final List<T> dataList) { Long count = redisTemplate.opsForList().rightPushAll(key, dataList); return count == null ? 0 : count; } /** * å é¤listä¸å ç´ value * @param key * @param value * @param <T> * @return */ public <T> long deleteCacheListByKeyAndValue(final String key, final T value) { Long count = redisTemplate.opsForList().remove(key,0,value); return count == null ? 0 : count; } @@ -188,8 +151,6 @@ return redisTemplate.opsForList().range(key, 0, -1); } /** * ç¼åSet * @@ -197,36 +158,21 @@ * @param dataSet ç¼åçæ°æ® * @return ç¼åæ°æ®ç对象 */ public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) { public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) { BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); Iterator<T> it = dataSet.iterator(); while (it.hasNext()) { setOperation.add(it.next()); } String i = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<Datas>\n" + "\t<Data code=\"A1100012\" deptLevel=\"å¼åé¨é¨#æµè¯é¨é¨\">\n" + "\t\t<prop sName=\"ä¾åºååç§°\" tName =\"ä¾åºååç§°1\" >\n" + "\t\t\tå京å®åè¿è¾¾ç§ææéå ¬å¸2\n" + "\t\t</prop>\n" + "\t\t<prop sName=\"æ·å¤´\" tName =\"æ·å¤´1\">\n" + "\t\t\t1111100012\n" + "\t\t</prop>\n" + "\t\t<prop sName=\"è系人\" tName=\"è系人1\">\n" + "\t\t\tè°¢å2\n" + "\t\t</prop>\n" + "\t</Data>\n" + "</Datas>"; return setOperation; } /** * è·å¾ç¼åçset * * @param key * @return * @param key key * @return éåçå 容 */ public <T> Set<T> getCacheSet(final String key) { @@ -236,11 +182,10 @@ /** * ç¼åMap * * @param key * @param dataMap * @param key key * @param dataMap æ°æ®æ å° */ public <T> void setCacheMap(final String key, final Map<String, T> dataMap) { public <T> void setCacheMap(final String key, final Map<String, T> dataMap) { if (dataMap != null) { redisTemplate.opsForHash().putAll(key, dataMap); } @@ -249,8 +194,8 @@ /** * è·å¾ç¼åçMap * * @param key * @return * @param key key * @return æ å° */ public <T> Map<String, T> getCacheMap(final String key) { @@ -264,8 +209,7 @@ * @param hKey Hashé® * @param value å¼ */ public <T> void setCacheMapValue(final String key, final String hKey, final T value) { public <T> void setCacheMapValue(final String key, final String hKey, final T value) { redisTemplate.opsForHash().put(key, hKey, value); } @@ -276,8 +220,7 @@ * @param hKey Hashé® * @return Hashä¸ç对象 */ public <T> T getCacheMapValue(final String key, final String hKey) { public <T> T getCacheMapValue(final String key, final String hKey) { HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); return opsForHash.get(key, hKey); } @@ -289,19 +232,243 @@ * @param hKeys Hashé®éå * @return Hash对象éå */ public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) { public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) { return redisTemplate.opsForHash().multiGet(key, hKeys); } /** * è·å¾ç¼åçåºæ¬å¯¹è±¡å表 * * * @param pattern å符串åç¼ * @return 对象å表 */ public Collection<String> keys(final String pattern) { public Collection<String> keys(final String pattern) { return redisTemplate.keys(pattern); } /** * 设置åå¸å¼é * @param key éçkey * @param value å¼ * @return true表示åå¨ï¼false表示ä¸åå¨ */ public synchronized Boolean setNX(final String key, final String value) throws Exception{ Object obj = null; try { obj = redisTemplate.execute((RedisCallback<Object>) connection -> { StringRedisSerializer serializer = new StringRedisSerializer(); Boolean success = connection.setNX(serializer.serialize(key), serializer.serialize(value)); connection.close(); return success; }); } catch (Exception e) { log.error("setNX redis error, key : {} - {}", key,e); throw e; } return obj != null ? (Boolean) obj : false; } /** * 设置åå¸å¼éï¼è¶ æ¶é´åä½ç§ * @param key éçkey * @param value å¼ * @param timeOut è¶ æ¶æ¶é´ * @return true表示åå¨ï¼false表示ä¸åå¨ */ public synchronized Boolean setNX(final String key, final String value,long timeOut) throws Exception { boolean b = this.setNX(key,value); redisTemplate.expire(key,timeOut,TimeUnit.SECONDS); return b; } /** * å é¤é * @param key éçkey */ public void unlock(final String key) { redisTemplate.delete(key); } /** * èªå 大äºçäº0 * @param key éçkey * @return Boolean */ public Boolean decrement(final String key) { return redisTemplate.opsForValue().decrement(key) >= 0; } public Boolean decrement(final String key, long count) { return redisTemplate.opsForValue().decrement(key,count) >= 0; } /** * èªå * @param key éçkey * @return Boolean */ public Long decrementLong(final String key) { return redisTemplate.opsForValue().decrement(key); } /** * èªå¢ * @param key éçkey * @return Boolean */ public Long increment(final String key) { return redisTemplate.opsForValue().increment(key); } public Long increment(final String key, long count) { return redisTemplate.opsForValue().increment(key,count); } /** * åç¼å¹é å é¤ * @param keyPrefix keyåç¼ */ public Boolean deleteByPrefix(final String keyPrefix) { List<String> list = new LinkedList<>(); ScanOptions build = ScanOptions.scanOptions().match(keyPrefix+":*").count(5000).build(); RedisSerializer<String> redisSerializer = redisTemplate.getKeySerializer(); Cursor cursor = (Cursor) redisTemplate.executeWithStickyConnection(redis -> new ConvertingCursor<>(redis.scan(build), redisSerializer::deserialize)); if (cursor != null){ try { while ( cursor.hasNext()) { list.add(cursor.next().toString()); } try { cursor.close(); } catch (IOException e) { e.printStackTrace(); log.error("redisä¸çCursorå ³é失败ï¼"); } } finally { try { cursor.close(); } catch (IOException e) { e.printStackTrace(); } } Long delete = redisTemplate.delete(list); log.info("å é¤èåkey: "+delete+"个ã\n 详æ :"+list.toString()); return delete > 0L; } return false; } /** * åç¼å¹é * @param keyPrefix keyåç¼ * */ public <T> List<T> findKeysByPrefix(final String keyPrefix) { List<T> list = new ArrayList<>(); ScanOptions build = ScanOptions.scanOptions().match(keyPrefix+":*").count(5000).build(); RedisSerializer<String> redisSerializer = redisTemplate.getKeySerializer(); Cursor cursor = (Cursor) redisTemplate.executeWithStickyConnection(redis -> new ConvertingCursor<>(redis.scan(build), redisSerializer::deserialize)); if (cursor != null){ try { while (cursor.hasNext()) { list.add(getCacheObject(cursor.next().toString())); } try { cursor.close(); } catch (IOException e) { e.printStackTrace(); } } finally { try { cursor.close(); } catch (IOException e) { e.printStackTrace(); } } return list; } return new ArrayList<>(); } /** * åºäºLuaèæ¬å®ç°ååæ¥è¯¢å¹¶å é¤ * @param key * @return */ public Boolean deleteLuaByKey(String key) { String str2 = "if redis.call('EXISTS', KEYS[1]) == 1 then redis.call('DEL', KEYS[1]) return 1 else return 0 end"; RedisScript<Boolean> redisScript = new DefaultRedisScript<>(str2,Boolean.class); Boolean execute = (Boolean) redisTemplate.execute(redisScript, Collections.singletonList(key)); return execute; } /** * GEO æ·»å æ°æ®(ç»çº¬åº¦) * @param key * @return */ public <T extends Point> void addGEO(String key, Map<String,T> map) { redisTemplate.opsForGeo().add(key,map); } /** * GEO æ·»å æ°æ®(ç»çº¬åº¦) * @param key * @return */ public <T extends Point> void addGEO(String key, Point point, String member) { redisTemplate.opsForGeo().add(key,point,member); } public <T extends Point> void removeGEO(String key,String... member) { redisTemplate.opsForGeo().remove(key,member); } /** * GEO æ¥è¯¢è·ç¦» * @param point éè¦æ¥è¯¢çå°å * @param key åå¸ * @param members èç¹ * @return map(åéº,è·ç¦») */ public Map<String,String> distanceGEO(Point point,String key, List<String> members) { GeoOperations geo = redisTemplate.opsForGeo(); long l = System.currentTimeMillis(); String member = "geo"+l; addGEO(key,point,member); Map<String,String> map = new HashMap<>(); members.forEach(e->{ Distance distance = geo.distance(key, member, e, Metrics.KILOMETERS); map.put(e,String.valueOf(distance.getValue())); }); removeGEO(key,key,member); return map; } /** * è·åListéåæä½ * @return æä½ */ public ListOperations opsForList(){ return this.redisTemplate.opsForList(); } /** * è·åSetéåæä½ * @return æä½ */ public SetOperations opsForSet(){ return this.redisTemplate.opsForSet(); } /** * è·åhashæä½ * @return æä½ */ public HashOperations opsForHash(){ return this.redisTemplate.opsForHash(); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LoginServiceI.java
@@ -2,6 +2,8 @@ import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.RequestClientInfo; import com.vci.starter.web.pagemodel.SessionInfo; import com.vci.starter.web.pagemodel.TokenVO; import com.vci.web.bo.LoginResultBO; import com.vci.web.dto.LoginUserDTO; @@ -36,4 +38,32 @@ * @throws VciBaseException å é¤ä¼è¯ä¿¡æ¯åºéçæ¶å伿åºå¼å¸¸ */ void logout(String userToken) throws VciBaseException; /** * å·æ°token * @param sessionInfo sessionçä¿¡æ¯ */ void refreshToken(SessionInfo sessionInfo); /** * å·æ°token * @param key tokenå¨redisä¸çkey * @param sessionInfo sessionçä¿¡æ¯ */ void refreshToken(String key, SessionInfo sessionInfo); /** * å建许å¯çä¿¡æ¯ * @param sessionInfo sessionçä¿¡æ¯ * @return 许å¯ä¿¡æ¯ */ TokenVO createToken(SessionInfo sessionInfo) ; /** * å建许å¯çä¿¡æ¯ * @param key tokenå¨redisä¸çkeyã * @param sessionInfo sessionçä¿¡æ¯ * @return 许å¯ä¿¡æ¯ */ TokenVO createToken(String key, SessionInfo sessionInfo) ; } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java
@@ -1,5 +1,8 @@ package com.vci.web.service.impl; import com.vci.client.logon.base.LogonHandler; import com.vci.corba.framework.data.LoginResult; import com.vci.corba.framework.data.LoginState; import com.vci.frameworkcore.ajaxTask.SmUserUnLockTask; import com.vci.frameworkcore.ajaxTask.SmUserUnLockTaskManager; import com.vci.frameworkcore.compatibility.ISmFunctionQueryService; @@ -7,27 +10,41 @@ import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; import com.vci.frameworkcore.pagemodel.SmUserVO; import com.vci.frameworkcore.properties.VciSecurityManageProperties; import com.vci.starter.web.annotation.bus.*; import com.vci.starter.web.annotation.bus.VciLoginAfter; import com.vci.starter.web.annotation.bus.VciLogoutBefore; import com.vci.starter.web.annotation.bus.VciLogoutPlugin; import com.vci.starter.web.constant.TokenKeyConstant; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.interceptor.VciSessionForLoginI; import com.vci.starter.web.pagemodel.RequestClientInfo; import com.vci.starter.web.pagemodel.SessionInfo; import com.vci.starter.web.pagemodel.TokenVO; import com.vci.starter.web.util.ApplicationContextProvider; import com.vci.starter.web.util.JwtUtils; import com.vci.starter.web.util.Md5; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.bo.LoginResultBO; import com.vci.web.constant.CacheNameConstant; import com.vci.web.dto.LoginUserDTO; import com.vci.web.properties.WebProperties; import com.vci.web.redis.RedisService; import com.vci.web.service.LoginServiceI; import com.vci.web.util.BusAnnotationUtil; import com.vci.web.util.PlatformClientUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.*; /** * ç»å½çæå¡ @@ -45,38 +62,56 @@ /** * ä¼è¯å¤ç */ @Autowired @Resource private VciSessionForLoginI sessionForLogin; /** * è§£éä»»å¡ */ @Autowired @Resource private SmUserUnLockTaskManager unLockTaskManager; /** * æé管ççç¸å ³é ç½® */ @Autowired @Resource private VciSecurityManageProperties securityManageProperties; /** * ç¨æ·æ¥è¯¢æå¡ï¼å¯ä»¥å ¼å®¹èå¹³å° */ @Autowired() @Resource private SmUserQueryServiceI userQueryService; /** * è§è²çæ¥è¯¢æå¡ï¼å¯ä»¥å ¼å®¹èå¹³å° */ @Autowired @Resource private SmRoleQueryServiceI roleQueryService; /** * æéçæ¥è¯¢æå¡ï¼å¯ä»¥å ¼å®¹èå¹³å° */ @Autowired @Resource private ISmFunctionQueryService functionQueryService; /** * redisæå¡ */ @Resource private RedisService redisService; /** * 客æ·ç«¯é ç½®æä»¶ */ @Resource private WebProperties webProperties; /** * å¹³å°è°ç¨å®¢æ·ç«¯ */ @Resource private PlatformClientUtil platformClientUtil; /** * æ§è¡ç»å½ @@ -101,195 +136,200 @@ LoginResultBO loginResult = new LoginResultBO(); loginResult.setSuccess(false); //1.å¤æç¨æ·çåºæ¬ä¿¡æ¯ // VciBaseUtil.alertNotNull(userDTO, "ç»å½ä¿¡æ¯", userDTO.getUserId(), "ç¨æ·è´¦å·"); // if (checkPassword) { // VciBaseUtil.alertNotNull(userDTO.getPassword(), "ç»å½å¯ç "); // } //ç»å½ä¹åè°ç¨æä»¶ BusAnnotationUtil.callForAnnotation(VciLoginPlugin.class,VciLoginBefore.class,userDTO,clientInfo); VciBaseUtil.alertNotNull(userDTO, "ç»å½ä¿¡æ¯", userDTO.getUserId(), "ç¨æ·è´¦å·"); if (checkPassword) { VciBaseUtil.alertNotNull(userDTO.getPassword(), "ç»å½å¯ç "); } // String loginInfo = checkIsLogined(userDTO.getUserId()); // if (!userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()) { // //éè¦ççæ¯å¦å·²ç»ç»å½äº // if (StringUtils.isNotBlank(loginInfo)) { // loginResult.setFailCode(USER_IS_LOGINED); // loginResult.setFailMsg(loginInfo); // return loginResult; // } // } //2.è·åç¨æ·ç对象.è¿ééè¦å ¼å®¹èå¹³å°åèpdmï¼èç¼ç åè平尿¯ä¸ä¸ªè¡¨ // SmUserVO user = userQueryService.getUserByUserId(userDTO.getUserId().trim()); // if (user == null || StringUtils.isEmpty(user.getOid())) { // loginResult.setFailCode(USER_NOT_FOUND); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); // return loginResult; // } //éè¦ççæ¯å¦å·²ç»ç»å½äº String loginKey = CacheNameConstant.cacheKey(CacheNameConstant.VCI_USER_LOGIN, userDTO.getUserId()); if(redisService.hasKey(loginKey) && !userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()){ loginResult.setFailCode(USER_IS_LOGINED); loginResult.setFailMsg("å½åç¨æ·å·²ç»å¨å ¶ä»å°æ¹ç»å½ï¼"); return loginResult; } //说æå·²ç»ç»å½äºï¼é£åºè¯¥åæ¶åæ¥çç»å½ if (redisService.hasKey(loginKey) && userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()) { redisService.deleteObject(CacheNameConstant.VCI_USER_LOGIN); } //2.è·åç¨æ·ç对象. SmUserVO user = getUserByUserId(userDTO.getUserId().trim()); if (user == null || StringUtils.isBlank(user.getOid())) { loginResult.setFailCode(USER_NOT_FOUND); loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); return loginResult; } //3ã夿å¯ç æ¯å¦æ£ç¡® if (checkPassword) { boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid()); if (!passwordIsEqual) { if (logger.isDebugEnabled()) { logger.debug("{}å¯ç 䏿£ç¡®", user.getId()); } } } //4ãè°ç¨å¹³å°ç»å½æ¥å£ï¼è¿è¡ç»å½ LogonHandler handler = new LogonHandler(); try { LoginResult chkRes = handler.checkLogin(userDTO.getUserId(), userDTO.getPassword()); loginResult.setFailCode(getErrorCode(chkRes)); loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), String.valueOf(chkRes.auxInfo)}); if(chkRes.state == LoginState.Error || chkRes.state == LoginState.Locked || chkRes.state == LoginState.Freeze){ return loginResult; } } catch (Exception e) { loginResult.setFailCode(SYSTEM_ERROR); loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); return loginResult; } //å¦æç¨æ·å·²ç»è¢«åç¨åéå®ï¼ä¸è½ç»å½ //å¦æç¨æ·çå¤±ææ¥æå·²ç»è¶ è¿äºå½åæ¶é´ï¼ä¸è½ç»å½ //åªææ°å¹³å°çç¨æ·æå¤æå¤±æ // if (FrameworkDataLCStatus.DISABLED.getValue().equals(user.getLcStatus())) { // loginResult.setFailCode(USER_IS_DISABLED); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); // return loginResult; // } // if (userQueryService.checkUserLock(user, user.getPwdWrongCount())) { // loginResult.setFailCode(USER_IS_LOCK); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); // return loginResult; // } // if (user.getDisabledate() != null) { // //2021çæ¬ææè¿ä¸ªå±æ§çå¼ï¼å½åè¿ä¸ªæ²¡æè¿ä¸ªå¼ // Date disableDate = VciDateUtil.addOrSubDate(user.getDisabledate(), Calendar.DATE, 1); // if (disableDate != null && disableDate.getTime() < System.currentTimeMillis()) { // loginResult.setFailCode(USER_MORE_THAN_DISABLE_DATE); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); // return loginResult; // } // } // if (user.getPwdWrongCount() == null) { // user.setPwdWrongCount(0); // } // SmPasswordStrategyVO passwordStrategyVO = userQueryService.getPasswordStrategyVOByUserOid(user.getOid()); // if (checkPassword) { // boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid()); // //3.å¤æç¨æ·çå¯ç æ¯å¦æ£ç¡® // if (!passwordIsEqual) { // //å端éè¦å md5䏿¬¡ï¼ç¶ååå°åMD5䏿¬¡ï¼ // if (logger.isDebugEnabled()) { // logger.debug("{}å¯ç 䏿£ç¡®", user.getId()); // } // if (passwordStrategyVO == null) { // //å¯è½æ°æ®é®é¢æ²¡æè®¾ç½®å¯ç çç¥ // passwordStrategyVO = new SmPasswordStrategyVO(); // passwordStrategyVO.setRetryTime(6); // passwordStrategyVO.setLockTime(30); // } // if (passwordStrategyVO.getRetryTime() <= (user.getPwdWrongCount() + 1)) { // user.setLockFlag(true); // updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); // addUserToUnLock(userDTO.getUserId(), passwordStrategyVO.getLockTime()); // updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); // loginResult.setFailCode(USER_PWD_LOCK); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), passwordStrategyVO.getLockTime() + ""}); // return loginResult; // } else { // //è¿æ²¡æå°éå®çæ¬¡æ° // updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); // //5, è¿æ¯ç¬¬ä¸æ¬¡é误ï¼å©ä¸çæ¯ 5- ï¼0+1ï¼ // loginResult.setFailCode(USER_PWD_NOT_EQUAL); // loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), (passwordStrategyVO.getRetryTime() - (user.getPwdWrongCount() + 1)) + ""}); // return loginResult; // } // } // } /**if (FrameworkDataLCStatus.DISABLED.getValue().equals(user.getLcStatus())) { loginResult.setFailCode(USER_IS_DISABLED); loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); return loginResult; } if (userQueryService.checkUserLock(user, user.getPwdWrongCount())) { loginResult.setFailCode(USER_IS_LOCK); loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); return loginResult; } if (user.getDisabledate() != null) { //2021çæ¬ææè¿ä¸ªå±æ§çå¼ï¼å½åè¿ä¸ªæ²¡æè¿ä¸ªå¼ Date disableDate = VciDateUtil.addOrSubDate(user.getDisabledate(), Calendar.DATE, 1); if (disableDate != null && disableDate.getTime() < System.currentTimeMillis()) { loginResult.setFailCode(USER_MORE_THAN_DISABLE_DATE); loginResult.setFailMsgArray(new String[]{userDTO.getUserId()}); return loginResult; } } SmPasswordStrategyVO passwordStrategyVO = userQueryService.getPasswordStrategyVOByUserOid(user.getOid()); if (checkPassword) { boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid()); //3.å¤æç¨æ·çå¯ç æ¯å¦æ£ç¡® if (!passwordIsEqual) { //å端éè¦å md5䏿¬¡ï¼ç¶ååå°åMD5䏿¬¡ï¼ if (logger.isDebugEnabled()) { logger.debug("{}å¯ç 䏿£ç¡®", user.getId()); } if (passwordStrategyVO == null) { //å¯è½æ°æ®é®é¢æ²¡æè®¾ç½®å¯ç çç¥ passwordStrategyVO = new SmPasswordStrategyVO(); passwordStrategyVO.setRetryTime(6); passwordStrategyVO.setLockTime(30); } if (passwordStrategyVO.getRetryTime() <= (user.getPwdWrongCount() + 1)) { user.setLockFlag(true); updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); addUserToUnLock(userDTO.getUserId(), passwordStrategyVO.getLockTime()); updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); loginResult.setFailCode(USER_PWD_LOCK); loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), passwordStrategyVO.getLockTime() + ""}); return loginResult; } else { //è¿æ²¡æå°éå®çæ¬¡æ° updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1); //5, è¿æ¯ç¬¬ä¸æ¬¡é误ï¼å©ä¸çæ¯ 5- ï¼0+1ï¼ loginResult.setFailCode(USER_PWD_NOT_EQUAL); loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), (passwordStrategyVO.getRetryTime() - (user.getPwdWrongCount() + 1)) + ""}); return loginResult; } } } //æ£æ¥æ¯å¦è¯¥ä¿®æ¹å¯ç if (!clientInfo.isSso() && checkPassword) { //æåä¿®æ¹æ¶é´+ å¤±ææ¶é´ï¼å¤§äºçäºå½åæ¥æï¼åéè¦é©¬ä¸ä¿®æ¹å¯ç Date currentDay = null; try { currentDay = VciDateUtil.getNow(VciDateUtil.DateFormat); } catch (Throwable e) { if (logger.isErrorEnabled()) { logger.error("è·åå½åæ¥æ", e); } } if (currentDay != null && passwordStrategyVO != null && passwordStrategyVO.getValidDay() != null) { Date inValidDay = null; if (user.getLastModifyPasswordTime() == null) { //éæ¥æ²¡æç»å½è¿ loginResult.setMustChangePassword(true); } else { inValidDay = VciDateUtil.addOrSubDate(user.getLastModifyPasswordTime(), Calendar.DATE, passwordStrategyVO.getValidDay()); if (inValidDay.getTime() <= (currentDay).getTime()) { loginResult.setMustChangePassword(true); } } if (!loginResult.isMustChangePassword()) { if (VciDateUtil.addOrSubDate(inValidDay, Calendar.DATE, -(passwordStrategyVO.getRemindDay())).getTime() <= (currentDay).getTime()) { //æ¨çå¯ç è¿æ{0}å¤©è¿æï¼è¯·åæ¶ä¿®æ¹å¯ç long remainDay = VciDateUtil.getDaySub(inValidDay, currentDay); loginResult.setPasswordInfo(MessageFormat.format(PASSWORD_REMAIN_DAY, new String[]{String.valueOf(remainDay)})); } } } }*/ //说æå¯ç æ£ç¡®ç // if (logger.isDebugEnabled()) { // logger.debug("{}çå¯ç æ£ç¡®", user.getId()); // } // user.setLastLoginTime(new Date()); // user.setPwdWrongCount(0); SmUserVO user = new SmUserVO(); user.setId("1"); user.setName("1"); user.setOid("1"); user.setUserType("1"); user.setUserTypeText("1"); user.setSecretGrade(1); user.setSecretGradeText("1"); user.setSex("1"); user.setSexText("1"); user.setPkPerson("1"); user.setPkPersonName("1"); user.setPkDepartment("1"); user.setPkDepartmentName("1"); user.setPkDuty("1"); user.setPkDutyName("1"); user.setEmail("1"); user.setTel("1"); user.setRtxNo("1"); user.setIMNo("1"); if (logger.isDebugEnabled()) { logger.debug("{}çå¯ç æ£ç¡®", user.getId()); } user.setLastLoginTime(new Date()); user.setPwdWrongCount(0); SessionInfo sessionInfo = new SessionInfo(); //æ·è´ç¨æ·çæ°å°sessionä¼è¯ä¸ copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode()); //æ·è´è¯·æ±ä¿¡æ¯å°sessionä¼è¯ä¸ copyRequest2SessionInfo(clientInfo, sessionInfo); //æ¥è¯¢ææçè§è² // List<SmRoleVO> roleVOList = roleQueryService.listRoleByUserOid(user.getOid(), null); // if (!CollectionUtils.isEmpty(roleVOList)) { // Map<String, String> roleOidNameMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t.getName())); // sessionInfo.setRolesName(roleOidNameMap); // } else { // sessionInfo.setRolesName(new HashMap()); // } /** //æ¥è¯¢ææçè§è² List<SmRoleVO> roleVOList = roleQueryService.listRoleByUserOid(user.getOid(), null); if (!CollectionUtils.isEmpty(roleVOList)) { Map<String, String> roleOidNameMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t.getName())); sessionInfo.setRolesName(roleOidNameMap); } else { sessionInfo.setRolesName(new HashMap()); } //æ¥è¯¢ææçæé // List<SmFunctionVO> functionVOList = functionQueryService.listFunctionByUserOid(user.getOid(), null, ResourceControlTypeEnum.BS); // if (!CollectionUtils.isEmpty(functionVOList)) { // List<String> functionOidList = functionVOList.stream().map(s -> s.getOid()).collect(Collectors.toList()); // sessionInfo.setFunctionOids(functionOidList); // } else { // sessionInfo.setFunctionOids(new ArrayList()); // } List<SmFunctionVO> functionVOList = functionQueryService.listFunctionByUserOid(user.getOid(), null, ResourceControlTypeEnum.BS); if (!CollectionUtils.isEmpty(functionVOList)) { List<String> functionOidList = functionVOList.stream().map(s -> s.getOid()).collect(Collectors.toList()); sessionInfo.setFunctionOids(functionOidList); } else { sessionInfo.setFunctionOids(new ArrayList()); }*/ loginResult.setSuccess(true); //æ£æ¥æ¯å¦è¯¥ä¿®æ¹å¯ç // if (!clientInfo.isSso() && checkPassword) { // //æåä¿®æ¹æ¶é´+ å¤±ææ¶é´ï¼å¤§äºçäºå½åæ¥æï¼åéè¦é©¬ä¸ä¿®æ¹å¯ç // Date currentDay = null; // try { // currentDay = VciDateUtil.getNow(VciDateUtil.DateFormat); // } catch (Throwable e) { // if (logger.isErrorEnabled()) { // logger.error("è·åå½åæ¥æ", e); // } // } // if (currentDay != null && passwordStrategyVO != null && passwordStrategyVO.getValidDay() != null) { // Date inValidDay = null; // if (user.getLastModifyPasswordTime() == null) { // //éæ¥æ²¡æç»å½è¿ // loginResult.setMustChangePassword(true); // } else { // inValidDay = VciDateUtil.addOrSubDate(user.getLastModifyPasswordTime(), Calendar.DATE, passwordStrategyVO.getValidDay()); // if (inValidDay.getTime() <= (currentDay).getTime()) { // loginResult.setMustChangePassword(true); // } // } // if (!loginResult.isMustChangePassword()) { // if (VciDateUtil.addOrSubDate(inValidDay, Calendar.DATE, -(passwordStrategyVO.getRemindDay())).getTime() // <= (currentDay).getTime()) { // //æ¨çå¯ç è¿æ{0}å¤©è¿æï¼è¯·åæ¶ä¿®æ¹å¯ç // long remainDay = VciDateUtil.getDaySub(inValidDay, currentDay); // loginResult.setPasswordInfo(MessageFormat.format(PASSWORD_REMAIN_DAY, new String[]{String.valueOf(remainDay)})); // } // } // } // } //忬æ³ä½¿ç¨jwtæ¥çætokenï¼ä½æ¯æä»¥ä¸é®é¢ //1.jwtä¸è½å¤ç注éçé®é¢ //2.jwtçæçtoken太é¿äº //3.å 为æ¬å¹³å°ä¸æ¯äºèç½ç³»ç»ï¼åªéè¦è§£å³åå¸å¼ç¨æ·ä¿¡æ¯çè·ååæéçæ ¡éªå³å¯ã //4.å¹³å°å¼ç¨äºredisåæ°æ®åºæ¥åå¨ä¼è¯çä¿¡æ¯ï¼åªéè¦ä¿è¯æ ¹æ®tokenè½è·åå°ä¼è¯ä¿¡æ¯å³å¯ //5.卿å¡å¯å¨çæ¶åï¼å°ä¼è¯ä¿¡æ¯æ¸ é¤ï¼å¨æ³¨éçæ¶åå°ä¼è¯ä¿¡æ¯æ¸ é¤ //uuidå¨é«å¹¶åçæ åµä¸ä¼éå¤ï¼ä½æ¯ä¼ ç»è½¯ä»¶å¹¶åå¾å°ï¼æä»¥åºç°çéå¤çæ¦çå¾å° sessionInfo.setToken(Md5.md5(VciBaseUtil.getPk() + "_" + user.getId())); loginResult.setSessionInfo(sessionInfo); // updateUserForLoginSuccess(user.getOid()); // if (StringUtils.isNotBlank(loginInfo) && userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()) { // //说æå·²ç»ç»å½äºï¼é£åºè¯¥åæ¶åæ¥çç»å½ // popUser(userDTO.getUserId()); // } //æ·»å å°ä¼è¯ä¿¡æ¯ // saveSessionInfo(sessionInfo); saveSessionInfo(sessionInfo); //ç»å½åæ§è¡ // BusAnnotationUtil.callForAnnotation(VciLoginPlugin.class,VciLoginAfter.class,userDTO,clientInfo,loginResult); return loginResult; } /** * è·åç¨æ·ä¿¡æ¯ * @param userId userId * @Return com.vci.frameworkcore.pagemodel.SmUserVO */ private SmUserVO getUserByUserId(String userId) { String userKey = CacheNameConstant.cacheKey(CacheNameConstant.VCI_USER,userId); String userOid = redisService.getCacheObject(userKey); String oidKey = CacheNameConstant.cacheKey(CacheNameConstant.VCI_USER_OID, userOid); SmUserVO userVO = redisService.getCacheObject(oidKey); if(userVO == null || StringUtils.isBlank(userVO.getOid())){ userVO = userQueryService.getUserByUserId(userId); } return userVO; } @@ -357,28 +397,7 @@ } } /** * æ ¡éªæ¯å¦ç»å½ * @param userId ç¨æ·å * @return å·²ç»ç»å½æ¶ï¼ */ private String checkIsLogined(String userId) { if(sessionForLogin == null){ throw new VciBaseException("没æé ç½®ä¼è¯åå¨çæå¡"); } return sessionForLogin.checkIsLogined(userId); } /** * æä»¥åçç»å½ä¿¡æ¯ç§»é¤ * @param userId ç¨æ·å */ private void popUser(String userId){ if(sessionForLogin == null){ throw new VciBaseException("没æé ç½®ä¼è¯åå¨çæå¡"); } sessionForLogin.popUser(userId); } /** * ä¿åä¼è¯ä¿¡æ¯ @@ -388,6 +407,11 @@ if(sessionForLogin == null){ throw new VciBaseException("没æé ç½®ä¼è¯åå¨çæå¡"); } //å°æéä¿¡æ¯ï¼æ¾å ¥redisç¼åä¸ã以鲿¢sessionä¸çä¿¡æ¯è¿å¤ï¼åå ¥æ°æ®åºä¸åºç°é误 redisService.setCacheList(sessionInfo.getToken(),sessionInfo.getFunctionOids()); redisService.expire(sessionInfo.getToken(), 1, TimeUnit.HOURS); sessionInfo.setFunctionOids(new ArrayList<>()); sessionForLogin.saveSessionInfo(sessionInfo); } @@ -438,10 +462,6 @@ sessionInfo.setRtxNo(user.getRtxNo()); sessionInfo.setIMId(user.getIMNo()); sessionInfo.setPortalId(user.getId()); // sessionInfo.setWorkNo(user.getWorkNo()); // sessionInfo.setWorkTypeOid(user.getPkWorkType()); // sessionInfo.setWorkTypeName(user.getPkWorkTypeText()); } /** @@ -475,4 +495,105 @@ private void updateUserForLoginSuccess(String userOid){ userQueryService.updateUserLoginTime(userOid); } /** * å建许å¯çä¿¡æ¯ * * @param sessionInfo sessionçä¿¡æ¯ * @return 许å¯ä¿¡æ¯ */ @Override public TokenVO createToken(SessionInfo sessionInfo) { return createToken(TokenKeyConstant.TOKEN_KEY_PREFIX_IN_REDIS, sessionInfo); } /** * å建许å¯çä¿¡æ¯ * @param key tokenå¨redisä¸çkey * @param sessionInfo sessionçä¿¡æ¯ * @return 许å¯ä¿¡æ¯ */ @Override public TokenVO createToken(String key, SessionInfo sessionInfo) { if(StringUtils.isBlank(sessionInfo.getToken())) { String token = Md5.md5(VciBaseUtil.getPk() + "_" + sessionInfo.getUserId()); sessionInfo.setToken(token); } if(StringUtils.isBlank(key)){ key = TokenKeyConstant.TOKEN_KEY_PREFIX_IN_REDIS; } refreshToken(key, sessionInfo); Map<String,Object> claimsMap = new HashMap<>(); claimsMap.put(TokenKeyConstant.JWT_TOKEN_KEY,sessionInfo.getToken()); claimsMap.put(TokenKeyConstant.JWT_USER_KEY,sessionInfo.getUserOid()); claimsMap.put(TokenKeyConstant.JWT_USER_NAME_KEY,sessionInfo.getUserName()); claimsMap.put(TokenKeyConstant.JWT_USER_CODE_KEY,sessionInfo.getUserId()); TokenVO tokenVO = new TokenVO(); tokenVO.setAccessToken(JwtUtils.createToken(claimsMap)); tokenVO.setExpireTime(TokenKeyConstant.EXPIRATION); return tokenVO; } /** * å·æ°token * @param sessionInfo sessionçä¿¡æ¯ */ @Override public void refreshToken(SessionInfo sessionInfo) { refreshToken(TokenKeyConstant.TOKEN_KEY_PREFIX_IN_REDIS, sessionInfo); } /** * å·æ°token * @param key tokenå¨redisä¸çkey * @param sessionInfo sessionçä¿¡æ¯ */ @Override public void refreshToken(String key, SessionInfo sessionInfo) { if(sessionInfo!=null && StringUtils.isNotBlank(sessionInfo.getToken())){ if(StringUtils.isBlank(key)){ key = TokenKeyConstant.TOKEN_KEY_PREFIX_IN_REDIS; } String redisKey = key + sessionInfo.getToken(); redisService.setCacheObject(redisKey, sessionInfo, webProperties.getClientSessionAliveMax()!=0?webProperties.getClientSessionAliveMax(): TokenKeyConstant.EXPIRATION, TimeUnit.MINUTES); } } /** * è·åç»å½é误ç * @param chkRes å¹³å°ç»å½æ ¡éªç»æ * @Return java.lang.String */ public String getErrorCode(LoginResult chkRes){ String message = ""; switch(chkRes.state.value()) { case 0: return ""; case 1: return LOGIN_SUCCESS; case 10: return USER_NOT_FOUND; case 11: return USER_PWD_NOT_EQUAL; case 12: return USER_IS_DISABLED; case 13: return USER_IS_LOCK; case 14: return PASSWORD_INIT; case 15: return PASSWORD_REMAIN_DAY; case 16: return PASSWORD_EXPIRE; case 17: return PASSWORD_POLICY_UPDATED; case 20: return SYSTEM_ERROR; default: message = SYSTEM_ERROR; break; } return message; } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -9,7 +9,6 @@ import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.model.OsAttributeDO; import com.vci.web.pageModel.OsAttributeVO; import com.vci.web.service.OsAttributeServiceI; @@ -19,8 +18,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -29,7 +26,6 @@ import java.util.stream.Collectors; import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * 屿§æ± æå¡ --å·²ç»è°ç¨äºå¹³å°çæå¡ï¼å æ¤ä¸å¨æä¾Daoå± @@ -126,7 +122,6 @@ * @return keyæ¯å±æ§çè±æåç§°å°åï¼valueæ¯å±æ§çæ¾ç¤ºå¯¹è±¡ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ATTRIBUTE,unless = "#result == null") @VciUnLog public Map<String, OsAttributeVO> selectAllAttributeMap() { return Optional.ofNullable(self.selectAllAttribute()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); @@ -428,7 +423,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ATTRIBUTE) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -11,7 +11,6 @@ import com.vci.starter.web.util.BeanUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.pageModel.*; import com.vci.web.service.*; import com.vci.web.util.ConcurrentDateFormat; @@ -20,16 +19,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * ä¸å¡ç±»åæå¡ @@ -106,7 +101,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_BTM,unless = "#result == null") public Map<String, OsBtmTypeVO> selectAllBtmMap() { return Optional.ofNullable(self.selectAllBtm()).orElseGet(()->new ArrayList<OsBtmTypeVO>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(), t->t,(o1,o2)->o1)); } @@ -339,7 +333,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_BTM) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -11,7 +11,6 @@ import com.vci.starter.web.pagemodel.PageHelper; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.constant.EnumIdConstant; import com.vci.web.pageModel.KeyValue; import com.vci.web.pageModel.OsEnumItemVO; @@ -26,8 +25,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -36,7 +33,6 @@ import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; import static com.vci.web.constant.EnumIdConstant.LC_STATUS_SUBFIX; /** @@ -226,7 +222,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ENUM,unless = "#result ==null") public Map<String, OsEnumVO> selectAllEnumMap() { return Optional.ofNullable(self.selectAllEnum()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); } @@ -465,7 +460,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ENUM) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
@@ -10,7 +10,6 @@ import com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.model.OsLifeCycleDO; import com.vci.web.pageModel.*; import com.vci.web.service.OsLifeCycleServiceI; @@ -22,8 +21,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -32,7 +29,6 @@ import java.util.stream.Collectors; import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_ID_NOT_EXIST; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; import static com.vci.web.constant.WebLangCodeConstant.LIFE_CYCLE_ROUTER_NULL; import static com.vci.web.constant.WebLangCodeConstant.LIFE_CYCLE_TRANS_ERROR; @@ -331,7 +327,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_LIFE_CYCLE,unless="#result == null") public Map<String,OsLifeCycleVO> selectAllLifeCycleMap() throws VciBaseException{ return Optional.ofNullable(self.selectAllLifeCycle()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId(),t->t,(o1,o2)->o1)); } @@ -340,7 +335,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_LIFE_CYCLE) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -9,7 +9,6 @@ import com.vci.starter.web.util.BeanUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.model.OsLinkTypeDO; import com.vci.web.pageModel.*; import com.vci.web.service.*; @@ -19,16 +18,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * 龿¥ç±»åæå¡ @@ -103,7 +98,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_Link,unless = "#result == null") public Map<String, OsLinkTypeVO> selectAllLinkMap() { return Optional.ofNullable(self.selectAllLink()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); } @@ -328,7 +322,6 @@ * æ¸ é¤ç¼å */ @Override @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_Link) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java
@@ -4,21 +4,17 @@ import com.vci.corba.omd.vrm.VersionRule; import com.vci.starter.web.annotation.log.VciUnLog; import com.vci.starter.web.util.VciDateUtil; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.pageModel.OsRevisionRuleVO; import com.vci.web.service.OsRevisionRuleServiceI; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CachePut; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * çæ¬è§åçæå¡ @@ -60,7 +56,6 @@ * @return key æ¯çæ¬çè±æåç§° */ @Override @CachePut(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_REVISION,unless = "#result ==null ") @VciUnLog public Map<String, OsRevisionRuleVO> selectAllRevisionMap() { return Optional.ofNullable(self.selectAllRevision()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); @@ -133,7 +128,6 @@ * æ¸ é¤ç¼å */ @Override @CachePut(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_REVISION) public void clearCache() { } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
@@ -23,8 +23,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -33,8 +31,6 @@ import java.util.stream.Collectors; import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; import static com.vci.web.constant.CacheKeyConstant.ALL_STATUS; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; /** * ç¶æçæå¡ @@ -139,7 +135,6 @@ /** * æ¸ é¤ç¼å */ @CacheEvict(value = VCI_OBJECT_SERVICE,key = ALL_STATUS) @Override public void clearCache(){ // @@ -151,7 +146,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = ALL_STATUS,unless = "#result == null") public Map<String,OsStatusVO> selectAllStatusMap(){ return Optional.ofNullable(self.selectAllStatus()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId(),t->t,(o1,o2)->o1)); } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -14,7 +14,6 @@ import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.constant.CacheKeyConstant; import com.vci.web.enumpck.UIComponentDisplayTypeEnum; import com.vci.web.enumpck.UIComponentTypeEnum; import com.vci.web.enumpck.UIFieldTypeEnum; @@ -33,9 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Caching; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -43,7 +39,6 @@ import java.util.*; import java.util.stream.Collectors; import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; import static com.vci.web.constant.EnumIdConstant.LC_STATUS_SUBFIX; /** @@ -175,7 +170,6 @@ * @return keyæ¯è¡¨åè±æåç§° */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM,unless = "#result == null") public Map<String, UIFormDefineVO> selectAllFormMap() { return Optional.ofNullable(self.selectAllForm()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getBtmType().toLowerCase() + SEP + s.getId().toLowerCase(),t->t,(o1,o2)->o1)); } @@ -404,7 +398,6 @@ * @return 表åçå®ä¹ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${formcache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 == null") public UIFormDefineVO getFormById(String btmId, String id) { if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){ return null; @@ -450,7 +443,6 @@ * @return è¡¨æ ¼çå®ä¹ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE,unless = "#result == null") @VciUnLog public List<UITableDefineVO> selectAllTable() { PortalVI[] portalVIS = null; @@ -724,7 +716,6 @@ * @return 表åçå®ä¹ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${tablecache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 == null") public UITableDefineVO getTableById(String btmId, String id) { if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){ return null; @@ -786,7 +777,6 @@ * @return æ¾ç¤ºå¯¹è±¡ï¼keyæ¯actionçä¸»é® */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key=CacheKeyConstant.ALL_ACTION,unless = "#result == null") public Map<String, UIActionVO> selectAllActionMap() { return Optional.ofNullable(self.selectAllAction()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t)); } @@ -843,13 +833,6 @@ * æ¸ é¤ç¼å */ @Override @Caching(evict = { @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_UI), @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_ACTION), @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM), @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE), @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_FORM_AND_TABLE) }) public void clearCache() { } @@ -861,7 +844,6 @@ */ @Override @VciUnLog @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_UI,unless = "#result == null") public List<UIContentVO> selectAllUIContent() { try { return UIContentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLUILayouts()).collect(Collectors.toList())); @@ -1067,7 +1049,6 @@ * @return åºåçæ¾ç¤ºå¯¹è±¡ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_LAYOUT,unless = "#result == null") public List<UILayoutVO> selectAllUILayout() { // try { // return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLTabPages()).collect(Collectors.toList()),true); @@ -1173,7 +1154,6 @@ * @return UIç»ä»¶ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_COMP ,unless = "#result ==null") public List<UIComponentVO> selectAllUIComponent() { // try { // return uiComponentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLPageDefinations()).collect(Collectors.toList()),false); @@ -1542,7 +1522,6 @@ * @return UIä¸ä¸æçä¿¡æ¯ */ @Override @Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${uicache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 ==null") public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) { WebUtil.alertNotNull(btmType,"ä¸å¡ç±»åæè 龿¥ç±»å",id,"UIä¸ä¸æçç¼å·"); PLUILayout[] obj = null; Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -1,13 +1,14 @@ package com.vci.web.service.impl; import com.vci.client.bof.ClientBusinessObject; import com.vci.client.bof.ClientLinkObject; import com.vci.client.common.oq.OQTool; import com.vci.client.common.providers.ServiceProvider; import com.vci.common.qt.object.*; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.PLException; import com.vci.corba.omd.data.AttributeValue; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.data.LinkObject; import com.vci.corba.omd.qtm.QTInfo; import com.vci.corba.query.ObjectQueryService; import com.vci.corba.query.ObjectQueryServicePrx; @@ -36,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; import java.util.*; @@ -256,8 +256,8 @@ */ private ClientBusinessObject cloneClientBusinessObject(ClientBusinessObject cbo){ if(cbo !=null){ com.vci.corba.omd.data.BusinessObject businessObject = new com.vci.corba.omd.data.BusinessObject(); com.vci.corba.omd.data.BusinessObject bo = cbo.getBusinessObject(); BusinessObject businessObject = new BusinessObject(); BusinessObject bo = cbo.getBusinessObject(); businessObject.oid = new ObjectUtility().getNewObjectID36(); businessObject.revisionid = new ObjectUtility().getNewObjectID36(); businessObject.nameoid = new ObjectUtility().getNewObjectID36(); @@ -307,10 +307,10 @@ * @param newAttrValList 屿§å¼å¯¹è±¡æ°ç» * @return æ·è´åçæ°å±æ§æ°ç» */ private com.vci.corba.omd.data.AttributeValue[] clone(com.vci.corba.omd.data.AttributeValue[] newAttrValList) { com.vci.corba.omd.data.AttributeValue[] n = new com.vci.corba.omd.data.AttributeValue[newAttrValList.length]; private AttributeValue[] clone(AttributeValue[] newAttrValList) { AttributeValue[] n = new AttributeValue[newAttrValList.length]; for (int i = 0; i < newAttrValList.length; i++) { n[i] = new com.vci.corba.omd.data.AttributeValue(newAttrValList[i].attrName,newAttrValList[i].attrVal); n[i] = new AttributeValue(newAttrValList[i].attrName,newAttrValList[i].attrVal); } return n; } @@ -400,7 +400,7 @@ Map<String,String> data = new HashMap<String, String>(); if(cbos!=null && cbos.size() > 0){ for(com.vci.client.bof.ClientBusinessObject cbo : cbos){ for(ClientBusinessObject cbo : cbos){ data.put(cbo.getAttributeValue(fieldName),cbo.getOid()); } } @@ -430,9 +430,9 @@ throw new VciBaseException("屿§" + columnName + "çå¼ä¸ºç©º"); } conditionMap.put(columnName,QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oidSet.toArray(new String[0])) + ")"); List<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); List<ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); if(cbos !=null && cbos.size() >0){ for(com.vci.client.bof.ClientBusinessObject cbo : cbos){ for(ClientBusinessObject cbo : cbos){ String oid = cbo.getAttributeValue(columnName); if(oidSet.contains(oid)){ oidSet.remove(oid); @@ -470,7 +470,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, public List<ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); clauseList.add("*"); @@ -487,7 +487,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, public List<ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); @@ -505,7 +505,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, public List<ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph, List<String> clauseList) throws VciBaseException { QueryTemplate qt = new QueryTemplate(); @@ -557,7 +557,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ */ private List<ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ List<com.vci.client.bof.ClientBusinessObject> allCbos = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); List<ClientBusinessObject> allCbos = new ArrayList<ClientBusinessObject>(); if(clauseList == null){ clauseList = new ArrayList<String>(); clauseList.add("*"); @@ -632,7 +632,7 @@ return allCbos; } public AttributeValue[] copyToAttributeValue(com.vci.corba.omd.data.AttributeValue[] attributeValues){ public AttributeValue[] copyToAttributeValue(AttributeValue[] attributeValues){ AttributeValue[] attributeValueList = new AttributeValue[attributeValues.length]; for (int i = 0; i < attributeValues.length; i++) { AttributeValue newAttributeValue = new AttributeValue(); @@ -716,7 +716,7 @@ * æ¥è¯¢çå½å¨æçå¼ * @param cbos ä¸å¡å¯¹è±¡ */ private void queryLcStatus(List<com.vci.client.bof.ClientBusinessObject> cbos){ private void queryLcStatus(List<ClientBusinessObject> cbos){ if(!CollectionUtils.isEmpty(cbos)){ Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); @@ -736,7 +736,7 @@ * @param enumAttrName æä¸¾å±æ§çå¼ * @throws VciBaseException */ private void queryEnumText(com.vci.client.bof.ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ private void queryEnumText(ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ queryEnumText(cbo,null,enumAttrName); } @@ -748,7 +748,7 @@ * @throws VciBaseException æ¥è¯¢æä¸¾åºéçæ¶å伿åºå¼å¸¸ */ @Override public void queryEnumText(com.vci.client.bof.ClientBusinessObject cbo, com.vci.client.bof.ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ public void queryEnumText(ClientBusinessObject cbo, ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ if(enumAttrName.size()>0){//æ¥è¯¢æä¸¾ for(String enumAttr:enumAttrName){//æ ¼å¼ä¸º code_field codeæ¯æä¸¾çç¼ç ï¼fieldæ¯å½åä¸å¡ç±»åå卿䏾å¼çåæ®µ if(enumAttr.toLowerCase().equals("creator_name")){ @@ -826,7 +826,7 @@ * @param attr 屿§å * @param value å¼ */ private void setValueToCboOrClo(com.vci.client.bof.ClientBusinessObject cbo,com.vci.client.bof.ClientLinkObject clo,String attr,String value){ private void setValueToCboOrClo(ClientBusinessObject cbo,ClientLinkObject clo,String attr,String value){ try { if (cbo != null) { cbo.setAttributeValueWithNoCheck(attr, value); @@ -845,13 +845,13 @@ * @param attributeValue 屿§çå¼ */ @Override public void setAttributeValueForClo(com.vci.client.bof.ClientLinkObject clo, String attributeName, String attributeValue) { com.vci.corba.omd.data.AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; ArrayList<com.vci.corba.omd.data.AttributeValue> attrValList = new ArrayList(); com.vci.corba.omd.data.AttributeValue attrVal; public void setAttributeValueForClo(ClientLinkObject clo, String attributeName, String attributeValue) { AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; ArrayList<AttributeValue> attrValList = new ArrayList(); AttributeValue attrVal; int i; if (attrValues != null && attrValues.length > 0) { com.vci.corba.omd.data.AttributeValue[] var9 = attrValues; AttributeValue[] var9 = attrValues; i = attrValues.length; for (int var7 = 0; var7 < i; ++var7) { @@ -864,7 +864,7 @@ boolean isExist = false; for (i = 0; i < attrValList.size(); ++i) { attrVal = (com.vci.corba.omd.data.AttributeValue) attrValList.get(i); attrVal = (AttributeValue) attrValList.get(i); if (attrVal.attrName.toUpperCase().equals(attributeName.toUpperCase())) { attrVal.attrVal = attributeValue; isExist = true; @@ -873,13 +873,13 @@ } if (!isExist) { attrVal = new com.vci.corba.omd.data.AttributeValue(); attrVal = new AttributeValue(); attrVal.attrName = attributeName.toUpperCase(); attrVal.attrVal = attributeValue; attrValList.add(attrVal); } clo.getLinkObject().newAttrValList = (com.vci.corba.omd.data.AttributeValue[]) attrValList.toArray(new com.vci.corba.omd.data.AttributeValue[attrValList.size()]); clo.getLinkObject().newAttrValList = (AttributeValue[]) attrValList.toArray(new AttributeValue[attrValList.size()]); } @@ -889,7 +889,7 @@ * @param enumAttrName æä¸¾å±æ§ * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ */ private void queryEnumTextClo(com.vci.client.bof.ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ private void queryEnumTextClo(ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ queryEnumText(null,clo,enumAttrName); } @@ -902,7 +902,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap) throws VciBaseException { PageHelper ph = new PageHelper(-1); @@ -920,7 +920,7 @@ * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); @@ -940,8 +940,7 @@ QueryTemplate qt = null; try{ VciBaseUtil.alertNotNull(name,"æ¥è¯¢æ¨¡æ¿çåç§°"); // QTWrapper wrapper = platformClientUtil.getQueryService().getQT(name); QTInfo wrapper = ServiceProvider.getOMDService().getQTDService().getQT(name); QTInfo wrapper = platformClientUtil.getQTDService().getQT(name); qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), name); //å 为ä¹åå¹³å°çTool.replaceQTValues 没æå¤ç ${xxx}ãï¼ ä¸ºäºå¿½ç¥å¤§å°åï¼æä»¬è¿éåç¬å¤ç weidy@2021-3-10 //æä»¬è½¬æ¢ä¸ºå°å @@ -1000,7 +999,7 @@ * @throws VciBaseException æ¥è¯¢åºé伿åºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException { QueryTemplate qt = getQtByName(queryScheme,replaceMap); @@ -1132,11 +1131,11 @@ * @throws VciBaseException æ¥è¯¢åºé伿åºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryBySql(String sql, public List<ClientBusinessObject> queryBySql(String sql, Map<String, String> conditionMap) throws VciBaseException { List<Map> allData = queryBySqlForMap(sql,conditionMap); if(allData == null || allData.size() == 0){ return new ArrayList<com.vci.client.bof.ClientBusinessObject>(); return new ArrayList<ClientBusinessObject>(); }else{ return map2Cbos(allData); } @@ -1149,10 +1148,10 @@ * @throws VciBaseException æ¥è¯¢åºéæ´»æåºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ public List<ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ List<Map> allData = queryByOnlySqlForMap(sql); if(allData == null || allData.size() == 0){ return new ArrayList<com.vci.client.bof.ClientBusinessObject>(); return new ArrayList<ClientBusinessObject>(); }else{ return map2Cbos(allData); } @@ -1171,12 +1170,11 @@ } List<Map> dataList = new ArrayList<>(); try { // KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); com.vci.corba.query.data.KV[][] kvs = ServiceProvider.getOQService().queryBySql(sql); KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); if(kvs!=null && kvs.length>0){ for (int i = 0; i < kvs.length; i++) { Map<String,String> data = new HashMap<>(); com.vci.corba.query.data.KV[] kv = kvs[i]; KV[] kv = kvs[i]; if(kv!=null && kv.length >0){ for (int j = 0; j < kv.length; j++) { KV kv1 = kv[j]; @@ -1260,9 +1258,9 @@ sql = sql.replaceAll(" FROM "," from "); } com.vci.corba.omd.data.AttributeValue[] ava = null; AttributeValue[] ava = null; if(conditionMap!=null&&!conditionMap.isEmpty()){ ava = new com.vci.corba.omd.data.AttributeValue[conditionMap.size()]; ava = new AttributeValue[conditionMap.size()]; Iterator<String> it = conditionMap.keySet().iterator(); int i = 0 ; while(it.hasNext()){ @@ -1271,16 +1269,15 @@ if(value == null){ value = ""; } com.vci.corba.omd.data.AttributeValue av = new com.vci.corba.omd.data.AttributeValue(key, value); AttributeValue av = new AttributeValue(key, value); ava[i] = av; i++; } }else{ ava = new com.vci.corba.omd.data.AttributeValue[0]; ava = new AttributeValue[0]; } try { // String[][] results =platformClientUtil.getBOFactoryService().getSqlQueryResult(sql, ava); String[][] results =ServiceProvider.getBOFService().getSqlQueryResult(sql, ava); String[][] results =platformClientUtil.getSqlQueryService(sql, ava); if(results.length>0){ if(selectKeys==null) { String selectSql = sql.substring(sql.toLowerCase(Locale.ROOT).indexOf("select") + 6, sql.toLowerCase(Locale.ROOT).indexOf(" from")).trim(); @@ -1367,11 +1364,11 @@ allFieldAttrMap.put(columnName.toLowerCase(),fieldName); } List<T> allObject = new ArrayList<T>(); List<com.vci.client.bof.ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//æ§è¡æ¥è¯¢ List<ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//æ§è¡æ¥è¯¢ List<String> oids = new ArrayList<String>(); if(allCbos!=null&&allCbos.size()>0){ for(com.vci.client.bof.ClientBusinessObject cbo : allCbos){ for(ClientBusinessObject cbo : allCbos){ T obj = null; try { obj = c.newInstance(); @@ -1472,10 +1469,10 @@ allFieldAttrMap.put(columnName.toLowerCase(),fieldName); } List<T> allObject = new ArrayList<T>(); List<com.vci.client.bof.ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); List<String> oids = new ArrayList<String>(); if(allCbos!=null&&allCbos.size()>0){ for(com.vci.client.bof.ClientBusinessObject cbo : allCbos){ for(ClientBusinessObject cbo : allCbos){ T obj = null; try { obj = c.newInstance(); @@ -1539,7 +1536,7 @@ * @param isEdit æ¯å¦ä¸ºç¼è¾ * @throws VciBaseException 设置åºé伿åºå¼å¸¸ */ private void setValueToCbo(Object obj,String btmType,com.vci.client.bof.ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ private void setValueToCbo(Object obj,String btmType,ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); if(pkField == null){ throw new VciBaseException("{0}ç±»ä¸æ²¡æå®ä¹ä¸»é®å±æ§",new Object[]{obj.getClass()}); @@ -1684,9 +1681,9 @@ if(list==null){ throw new VciBaseException(VciBaseException.paramNull); } Set<com.vci.client.bof.ClientBusinessObject> allUpdateCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); Set<com.vci.client.bof.ClientBusinessObject> allDeleteCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); Set<com.vci.client.bof.ClientBusinessObject> allAddCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); Set<ClientBusinessObject> allUpdateCbos = new HashSet<ClientBusinessObject>(); Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); Set<ClientBusinessObject> allAddCbos = new HashSet<ClientBusinessObject>(); Map<String,String> btmOidsMap = new HashMap<String, String>(); for(T obj : list){ String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); @@ -1707,7 +1704,7 @@ } btmOidsMap.put(btmType, tempOids); } List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); List<ClientBusinessObject> needUpdateCbos = new ArrayList<ClientBusinessObject>(); Iterator<String> it = btmOidsMap.keySet().iterator(); while(it.hasNext()){ String btmType = it.next(); @@ -1725,11 +1722,11 @@ } //ä¸»é® Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); com.vci.client.bof.ClientBusinessObject cbo = null; ClientBusinessObject cbo = null; if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ continue; }else{ for(com.vci.client.bof.ClientBusinessObject tempCbo : needUpdateCbos){ for(ClientBusinessObject tempCbo : needUpdateCbos){ if(tempCbo.getOid().equalsIgnoreCase(pkValue.toString().trim())){ cbo = tempCbo; break; @@ -1738,7 +1735,7 @@ } String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); //æ·è´ä¹åå æ¸ é¤å·²ç»æçå¼ cbo.getBusinessObject().newAttrValList = new com.vci.corba.omd.data.AttributeValue[0]; cbo.getBusinessObject().newAttrValList = new AttributeValue[0]; setValueToCbo(obj,btmType,cbo,true); allUpdateCbos.add(cbo); } @@ -2246,7 +2243,7 @@ * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ */ @Override public Map cbo2Map(com.vci.client.bof.ClientBusinessObject cbo) throws VciBaseException { public Map cbo2Map(ClientBusinessObject cbo) throws VciBaseException { Map<String,String> map = new HashMap<String, String>(); WebUtil.copyValueToMapFromCbos(cbo, map); return map; @@ -2260,9 +2257,9 @@ * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ */ @Override public List<com.vci.client.bof.ClientBusinessObject> map2Cbos(List<Map> mapList) public List<ClientBusinessObject> map2Cbos(List<Map> mapList) throws VciBaseException { List<com.vci.client.bof.ClientBusinessObject> cboList = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); List<ClientBusinessObject> cboList = new ArrayList<ClientBusinessObject>(); for(Map map : mapList){ cboList.add(map2Cbo(map)); } @@ -2277,8 +2274,8 @@ * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ */ @Override public com.vci.client.bof.ClientBusinessObject map2Cbo(Map map) throws VciBaseException { com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); public ClientBusinessObject map2Cbo(Map map) throws VciBaseException { ClientBusinessObject cbo = new ClientBusinessObject(); WebUtil.copyValueToCboFromMap(cbo, map); return cbo; } @@ -2311,13 +2308,7 @@ deleteReferAttrInCbo(batchCbos.getDeleteCbos()); } try { // platformClientUtil.getBOFactoryService().batchCUDBOLO(new BusinessObjectListHolder(cboArray2Bo(batchCbos.getCreateCboArray())), // new LinkObjectListHolder(cloArray2Lo(batchCbos.getCreateCloArray())), // new BusinessObjectListHolder(cboArray2Bo(batchCbos.getUpdateCboArray())), // new LinkObjectListHolder(cloArray2Lo(batchCbos.getUpdateCloArray())), // cboArray2Bo(batchCbos.getDeleteCboArray()), cloArray2Lo(batchCbos.getDeleteCloArray())); // new BusinessObjectListHolder(cboArray2Bo(batchCbos.getCreateCboArray())) ServiceProvider.getBOFService().batchCUDBOLO(cboArray2Bo(batchCbos.getCreateCboArray()), platformClientUtil.getBOFactoryService().batchCUDBOLO(cboArray2Bo(batchCbos.getCreateCboArray()), cloArray2Lo(batchCbos.getCreateCloArray()), cboArray2Bo(batchCbos.getUpdateCboArray()), cloArray2Lo(batchCbos.getUpdateCloArray()), @@ -2332,11 +2323,11 @@ * @param cbos 客æ·ç«¯å¯¹è±¡ * @return ä¸å¡å¯¹è±¡ */ private com.vci.corba.omd.data.BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ private BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ if(cbos == null ||cbos.length == 0){ return new com.vci.corba.omd.data.BusinessObject[0]; return new BusinessObject[0]; } com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[cbos.length]; BusinessObject[] bos = new BusinessObject[cbos.length]; for(int i = 0; i < cbos.length; i++){ bos[i] = cbos[i].getBusinessObject(); } @@ -2348,11 +2339,11 @@ * @param clos 客æ·ç«¯å¯¹è±¡ * @return ä¸å¡å¯¹è±¡ */ private com.vci.corba.omd.data.LinkObject[] cloArray2Lo(com.vci.client.bof.ClientLinkObject[] clos){ private LinkObject[] cloArray2Lo(ClientLinkObject[] clos){ if(clos == null ||clos.length == 0){ return new com.vci.corba.omd.data.LinkObject[0]; return new LinkObject[0]; } com.vci.corba.omd.data.LinkObject[] bos = new com.vci.corba.omd.data.LinkObject[clos.length]; LinkObject[] bos = new LinkObject[clos.length]; for(int i = 0; i < clos.length; i++){ bos[i] = clos[i].getLinkObject(); } @@ -2366,11 +2357,11 @@ private void deleteReferAttrInCbo(Set<ClientBusinessObject> cbos){ if(cbos !=null){ for(ClientBusinessObject cbo : cbos){ com.vci.corba.omd.data.BusinessObject bo = cbo.getBusinessObject(); List<com.vci.corba.omd.data.AttributeValue> newAttr = new ArrayList<com.vci.corba.omd.data.AttributeValue>(); BusinessObject bo = cbo.getBusinessObject(); List<AttributeValue> newAttr = new ArrayList<AttributeValue>(); if (bo.newAttrValList != null) { for (int i = 0; i < bo.newAttrValList.length; ++i) { com.vci.corba.omd.data.AttributeValue av = bo.newAttrValList[i]; AttributeValue av = bo.newAttrValList[i]; if (WebUtil.isNormalAttr(av.attrName)) { if(av.attrVal == null){ av.attrVal = ""; @@ -2379,7 +2370,7 @@ } } } bo.newAttrValList = newAttr.toArray(new com.vci.corba.omd.data.AttributeValue[0]); bo.newAttrValList = newAttr.toArray(new AttributeValue[0]); cbo.setBusinessObject(bo); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebHomeTaskServiceImpl.java
@@ -50,7 +50,6 @@ * @return 任塿±æ»çæ°é */ @Override @Cacheable(value = VCI_USER,key = "'userHomeTask'.concat(#root.target.getCurrentUserOid())", unless = "#result == null") public List<WebHomeTaskActionVO> listMyHomeTask() { List<WebHomeTaskActionVO> actionVOS = new ArrayList<>(); List<WebHomeTaskActionDO> allActions = boService.queryObject(WebHomeTaskActionDO.class,null); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/BusAnnotationUtil.java
@@ -1,7 +1,5 @@ package com.vci.web.util; import com.vci.starter.web.annotation.bus.VciLoginBefore; import com.vci.starter.web.annotation.bus.VciLoginPlugin; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.util.ApplicationContextProvider; import org.slf4j.Logger; Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java
@@ -4,11 +4,14 @@ import com.vci.corba.bofactory.BOFactoryServicePrx; import com.vci.corba.common.PLException; import com.vci.corba.framework.FrameworkServicePrx; import com.vci.corba.log.LogServicePrx; import com.vci.corba.omd.atm.AttPoolServicePrx; import com.vci.corba.omd.btm.BTMServicePrx; import com.vci.corba.omd.data.AttributeValue; import com.vci.corba.omd.etm.EnumServicePrx; import com.vci.corba.omd.lcm.LifeCycleServicePrx; import com.vci.corba.omd.ltm.LinkTypeServicePrx; import com.vci.corba.omd.qtm.QTDServicePrx; import com.vci.corba.omd.stm.StatePoolServicePrx; import com.vci.corba.omd.vrm.VersionRuleServicePrx; import com.vci.corba.portal.PortalServicePrx; @@ -125,7 +128,6 @@ */ public EnumServicePrx getEnumService() throws PLException { return ServiceProvider.getOMDService().getEnumService(); // return EnumServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ENUM_SERVICE_NAME)); } /** @@ -134,7 +136,6 @@ */ public VersionRuleServicePrx getVersionService() throws PLException { return ServiceProvider.getOMDService().getVerRuleService(); // return VersionRuleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(VERSION_SERVICE_NAME)); } /** @@ -143,7 +144,6 @@ */ public AttPoolServicePrx getAttributeService() throws PLException { return ServiceProvider.getOMDService().getAttributeService(); // return AttPoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ATTRIBUTE_SERVICE_NAME)); } /** @@ -152,7 +152,6 @@ */ public BTMServicePrx getBtmService() throws PLException { return ServiceProvider.getOMDService().getBTMService(); // return BTMServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BTM_SERVICE_NAME)); } /** @@ -161,7 +160,6 @@ */ public LinkTypeServicePrx getLinkTypeService() throws PLException { return ServiceProvider.getOMDService().getLinkTypeService(); // return LinkTypeServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LINK_SERVICE_NAME)); } /** @@ -170,7 +168,6 @@ */ public PortalServicePrx getPortalService(){ return ServiceProvider.getUIService(); // return PortalServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(PORTAL_SERVICE_NAME)); } /** @@ -179,7 +176,6 @@ */ public ObjectQueryServicePrx getQueryService(){ return ServiceProvider.getOQService(); // return QTServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(QUERY_SERVICE_NAME)); } /** @@ -189,7 +185,31 @@ */ public VolumeServicePrx getVolumeService(String volumeName){ return ServiceProvider.getVolumeService(volumeName); // return VolumnFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByUrlAndServiceName(serverUrl,volumeName)); } /** * æ¥è¯¢æ¨¡æ¿æå¡ * @return å·æå¡çç对象 */ public QTDServicePrx getQTDService() throws PLException { return ServiceProvider.getOMDService().getQTDService(); } /** * æ¥è¯¢æ¨¡æ¿æå¡ * @param sql sqlè¯å¥ * @param attrVals å ä½ç¬¦çå¼ * @return å·æå¡çç对象 */ public String[][] getSqlQueryService(String sql, AttributeValue[] attrVals) throws PLException { return ServiceProvider.getBOFService().getSqlQueryResult(sql, attrVals); } /** * è·åç»å½æ¥å¿æå¡ * @Return com.vci.corba.log.LogServicePrx */ public LogServicePrx getLogService(){ return ServiceProvider.getLogService(); } } Source/plt-web/plt-web-parent/plt-web/src/main/resources/application-dev.yml
@@ -38,11 +38,11 @@ spring: # redisé ç½® redis: ###### redis é ç½® enabled: false #trueï¼å¯ç¨rediï¼falseä¸å¯ç¨ï¼é»è®¤false,é ç½®æä»¶æ²¡æè¿äºé»è®¤ä¸å¯ç¨redis host: vciserver # ipå°å database: 0 # redisæ°æ®åº 0-15 enabled: true #trueï¼å¯ç¨rediï¼falseä¸å¯ç¨ï¼é»è®¤false,é ç½®æä»¶æ²¡æè¿äºé»è®¤ä¸å¯ç¨redis host: localhost # ipå°å database: 2 # redisæ°æ®åº 0-15 port: 6379 # 端å£å· password: vcitest # æ å¯ç ä¸å¡« password: 123456 # æ å¯ç ä¸å¡« timeout: 30000s # è¿æ¥è¶ æ¶æ¶é´ ï¼é»è®¤1å¤©ï¼ lettuce: shutdown-timeout: 100ms # å ³éè¶ æ¶æ¶é´ é»è®¤ 100ms Source/plt-web/plt-web-parent/plt-web/src/main/resources/i18n/messages.properties
@@ -71,6 +71,11 @@ lessMinLength=\u5BC6\u7801\u4E0D\u6EE1\u8DB3\u6700\u4F4E\u957F\u5EA6\u8981\u6C42\uFF0C\u9700\u8981{0}\u957F\u5EA6 moreMaxLength=\u5BC6\u7801\u4E0D\u6EE1\u8DB3\u6700\u5927\u957F\u5EA6\u8981\u6C42\uFF0C\u4EC5\u80FD\u8F93\u5165{0}\u957F\u5EA6 passwordRemainDay=\u5BC6\u7801\u5373\u5C06\u8FC7\u671F\uFF0C\u8BF7\u5C3D\u5FEB\u4FEE\u6539 systemError=\u7CFB\u7EDF\u5F02\u5E38 loginSuccess=\u767B\u5F55\u6210\u529F passwordInit=\u8D26\u53F7\u5BC6\u7801\u4E3A\u521D\u59CB\u5BC6\u7801\uFF0C\u9700\u8981\u4FEE\u6539\u540E\u624D\u80FD\u767B\u5F55 passwordExpire=\u5BC6\u7801\u5DF2\u8FC7\u671F passwordPolicyUpdated=\u5BC6\u7801\u7B56\u7565\u5DF2\u7ECF\u4FEE\u6539\uFF0C\u9700\u4FEE\u6539\u8D26\u53F7\u5BC6\u7801 #########\u7CFB\u7EDF\u8D44\u6E90\u76F8\u5173###### com.vci.web.menu.noHasFunction= {0}\u6CA1\u6709\u4EFB\u4F55\u7684\u6743\u9650 Source/plt-web/plt-web-parent/plt-web/src/main/resources/i18n/messages_zh_CN.properties
@@ -71,6 +71,11 @@ lessMinLength=\u5BC6\u7801\u4E0D\u6EE1\u8DB3\u6700\u4F4E\u957F\u5EA6\u8981\u6C42\uFF0C\u9700\u8981{0}\u957F\u5EA6 moreMaxLength=\u5BC6\u7801\u4E0D\u6EE1\u8DB3\u6700\u5927\u957F\u5EA6\u8981\u6C42\uFF0C\u4EC5\u80FD\u8F93\u5165{0}\u957F\u5EA6 passwordRemainDay=\u5BC6\u7801\u5373\u5C06\u8FC7\u671F\uFF0C\u8BF7\u5C3D\u5FEB\u4FEE\u6539 systemError=\u7CFB\u7EDF\u5F02\u5E38 loginSuccess=\u767B\u5F55\u6210\u529F passwordInit=\u8D26\u53F7\u5BC6\u7801\u4E3A\u521D\u59CB\u5BC6\u7801\uFF0C\u9700\u8981\u4FEE\u6539\u540E\u624D\u80FD\u767B\u5F55 passwordExpire=\u5BC6\u7801\u5DF2\u8FC7\u671F passwordPolicyUpdated=\u5BC6\u7801\u7B56\u7565\u5DF2\u7ECF\u4FEE\u6539\uFF0C\u9700\u4FEE\u6539\u8D26\u53F7\u5BC6\u7801 #########\u7CFB\u7EDF\u8D44\u6E90\u76F8\u5173###### com.vci.web.menu.noHasFunction= {0}\u6CA1\u6709\u4EFB\u4F55\u7684\u6743\u9650