From 889842eb8b64a0b72c449ce23ff21e4e8c935cae Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 26 七月 2024 16:06:49 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 71 +++++++++++++++++++++++++---------- 1 files changed, 51 insertions(+), 20 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java index dbea2f7..d08bcbb 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.frameworkcore.compatibility.impl; +import com.vci.dto.SmUserDTO; import com.vci.common.util.ThreeDES; import com.vci.corba.common.PLException; import com.vci.corba.common.data.UserEntityInfo; @@ -9,14 +10,13 @@ import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI; import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; -import com.vci.frameworkcore.model.dto.SmUserDTO; -import com.vci.frameworkcore.model.SmUserDO; -import com.vci.frameworkcore.model.po.SmUserPO; -import com.vci.frameworkcore.pagemodel.OrgDepartmentVO; -import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO; -import com.vci.frameworkcore.pagemodel.SmRoleVO; -import com.vci.frameworkcore.pagemodel.SmUserVO; -import com.vci.frameworkcore.properties.ConfigReader; +import com.vci.model.SmUserDO; +import com.vci.pagemodel.SmUserVO; +import com.vci.po.SmUserPO; +import com.vci.pagemodel.OrgDepartmentVO; +import com.vci.pagemodel.SmPasswordStrategyVO; +import com.vci.pagemodel.SmRoleVO; +import com.vci.frameworkcore.properties.ConfigCorbaReader; import com.vci.omd.utils.ObjectTool; import com.vci.starter.poi.bo.ReadExcelOption; import com.vci.starter.poi.bo.WriteExcelData; @@ -183,7 +183,7 @@ * @return 鐢ㄦ埛鐨勪俊鎭� * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ - private SmUserVO getUserByField(String queryField,String queryValue) throws VciBaseException{ + private SmUserVO getUserByField(String queryField, String queryValue) throws VciBaseException{ VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(null, SmUserDO.class,null,true); queryWrapper.eq(queryWrapper.getTableNick() + "." +queryField,queryValue); queryWrapper.setDistinct(true); @@ -1021,23 +1021,52 @@ /** * 淇敼瀵嗙爜 * @param userOid 鐢ㄦ埛涓婚敭 + * @param oldPassword 鏃х殑瀵嗙爜 * @param password 鏂扮殑瀵嗙爜 * @param confirmPassword 纭瀵嗙爜 */ @Override @Transactional(rollbackFor = Exception.class) - public void changePassword(String userOid, String password, - String confirmPassword) throws VciBaseException { - WebUtil.alertNotNull(userOid,"鐢ㄦ埛涓婚敭",password,"瀵嗙爜",confirmPassword,"纭瀵嗙爜"); + public boolean changePassword(String userOid,String oldPassword, String password, + String confirmPassword) throws Exception { + WebUtil.alertNotNull(userOid,"鐢ㄦ埛涓婚敭",oldPassword,"鐧诲綍瀵嗙爜",password,"瀵嗙爜",confirmPassword,"纭瀵嗙爜"); if(!password.equals(confirmPassword)){ throw new VciBaseException("瀵嗙爜鍜岀‘璁ゅ瘑鐮佷笉鐩哥瓑"); } + //瀵规棫瀵嗙爜鍜屽瘑鐮佽繘琛岃В瀵嗭紝渚夸簬姣斿瀵嗙爜鐢� + oldPassword = Func.decryptAes(oldPassword,"daliantan0v0vcip"); + password = Func.decryptAes(password,"daliantan0v0vcip"); + //瀵规瘮鏃у瘑鐮� + boolean b = this.checkPasswordEqual(oldPassword, userOid); + if(!b){ + throw new PLException("500", new String[] { "鎮ㄨ緭鍏ョ殑瀵嗙爜涓庣櫥褰曞瘑鐮佷笉涓�鑷�,璇烽噸鏂拌緭鍏�!"}); + } + SmUserVO smUserVO = getUserByUserOid(userOid); + if(Func.isEmpty(smUserVO)){ + throw new VciBaseException("褰撳墠淇敼鐨勭敤鎴蜂笉瀛樺湪锛�"); + } + //TODO:鏍¢獙瀵嗙爜鏄惁绗﹀悎绛栫暐 + String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(smUserVO.getId(), password,null); + if (!StringUtils.isBlank(error)) { + throw new VciBaseException("褰撳墠璁剧疆鐨勫瘑鐮侊紝瀵嗙爜绛栫暐鏍¢獙鏈�氳繃!"); + } + + //TODO:鑰冭檻鏄惁闇�瑕佸皢淇敼鏂瑰紡鏀规垚鐩存帴璋冪敤骞冲彴鐨勬帴鍙o紝鍥犱负鐜板湪鐨勪慨鏀规柟寮忔病鑳芥纭殑鏇存柊缂撳瓨 + /*UserInfo userInfo = new UserInfo(); + userInfo.id = userOid.trim(); + userInfo.pwd = password; + userInfo.pwdUpdateTime = System.currentTimeMillis(); + boolean updateBoolean = platformClientUtil.getFrameworkService().updateUser(userInfo, new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)); + return updateBoolean;*/ + ThreeDES des = new ThreeDES();// 瀹炰緥鍖栦竴涓锟�? des.getKey("daliantan0v0");// 鐢熸垚瀵嗗寵 String encPassword = des.getEncString(password); - String sql = "update pluser set plpassword = '" + encPassword + "' where pluid = '" + userOid.trim() + "'"; + //淇敼瀵嗙爜鐨勫悓鏃堕渶瑕佸皢瀵嗙爜淇敼鏃堕棿涔熸洿鏂� + String sql = "update pluser set plpassword = '" + encPassword + "', plpwdupdatetime = TO_DATE('" + + Func.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"','yyyy-MM-dd hh24:mi:ss') where pluid = '" + userOid.trim() + "'"; try { - platformClientUtil.getBOFactoryService().executeUpdateSql(sql); + return platformClientUtil.getBOFactoryService().executeUpdateSql(sql); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1213,8 +1242,8 @@ } //鏍规嵁褰撳墠鍒涘缓杩欎釜鐢ㄦ埛鐨勪汉鎵�缁戝畾瀵嗙爜绛栫暐鏉ヨ繘琛屽瘑鐮佹牎楠� try { - String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); - String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userName, smUserDTO.getPassword(),null); + String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userId, smUserDTO.getPassword(),null); if (!StringUtils.isBlank(error)) { throw new VciBaseException("褰撳墠璁剧疆鐨勫瘑鐮侊紝瀵嗙爜绛栫暐鏍¢獙鏈�氳繃"); } @@ -1293,7 +1322,7 @@ // 璁剧疆琛ㄥ崟鍒楀悕 List<String> columns = new ArrayList<>(Arrays.asList("璐﹀彿", "瀵嗙爜", "濮撳悕", "鐢靛瓙閭", "涓撲笟", "鎻忚堪", "閮ㄩ棬(涓婁笅绾ч儴闂ㄤ箣闂翠互鍙嶆枩鏉犻殧寮�(/))")); //鑾峰彇鏄惁瀵煎嚭瀵嗙骇閰嶇疆椤� - String flag = ConfigReader.getConfigValue("exportSecretGrade"); + String flag = ConfigCorbaReader.getConfigValue("exportSecretGrade"); if (flag != null && flag.equalsIgnoreCase("true")) { columns = new ArrayList<>(Arrays.asList("璐﹀彿", "瀵嗙爜", "濮撳悕", "鐢靛瓙閭", "涓撲笟", "鎻忚堪", "閮ㄩ棬(涓婁笅绾ч儴闂ㄤ箣闂翠互鍙嶆枩鏉犻殧寮�(/))" ,"瀵嗙骇")); } @@ -1333,7 +1362,7 @@ * @throws VciBaseException */ @Override - public BaseResult importUser(File file) throws VciBaseException { + public BaseResult importUser(File file) throws Exception { VciBaseUtil.alertNotNull(file,"excel鏂囦欢"); if(!file.exists()){ throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()}); @@ -1345,7 +1374,7 @@ String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null); //鏄惁瀵煎叆瀵嗙骇閰嶇疆 - boolean exportSecretGrade = Boolean.parseBoolean(ConfigReader.getConfigValue("exportSecretGrade")); + boolean exportSecretGrade = Boolean.parseBoolean(ConfigCorbaReader.getConfigValue("exportSecretGrade")); List<SmUserPO> poList = ExcelUtil.readDataObjectFromExcel(file, SmUserPO.class,excelOption,(value, po, fieldName)->{ Integer secretValue = UserSecretEnum.getSecretValueByText(po.getSecretGradeText()); //鏄惁蹇呴』瀵煎叆瀵嗙骇 @@ -1369,7 +1398,9 @@ //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氳处鍙凤紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); //鍏堣幏鍙栧叏閮ㄩ儴闂ㄥ悕绉扮殑鐖跺瓙瀵瑰簲鍏崇郴锛歬ey涓洪儴闂ㄥ瓙鐖剁骇鍚嶇О璺緞锛寁alue涓洪儴闂ㄤ俊鎭� - Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap(); + List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.getDeptAllFullName(); + Map<String, OrgDepartmentVO> deptVOMap = orgDepartmentVOList.stream().collect(Collectors.toMap(OrgDepartmentVO::getFullDeptNamePath, s->s)); + //Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap(); //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 List<String> finalRepeatUserId = repeatUserId; poList.stream().forEach(smUserPO -> { -- Gitblit v1.9.3