| | |
| | | import com.vci.pagemodel.OrgDepartmentVO; |
| | | import com.vci.pagemodel.SmPasswordStrategyVO; |
| | | import com.vci.pagemodel.SmRoleVO; |
| | | import com.vci.frameworkcore.properties.ConfigReader; |
| | | 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; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean changePassword(String userOid,String oldPassword, String password, |
| | | String confirmPassword) throws PLException { |
| | | 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[] { "您输入的密码与登录密码不一致,请重新输入!"}); |
| | | } |
| | | if(!password.equals(confirmPassword)){ |
| | | throw new VciBaseException("密码和确认密码不相等"); |
| | | } |
| | | SmUserVO smUserVO = getUserByUserOid(userOid); |
| | | if(Func.isEmpty(smUserVO)){ |
| | |
| | | if (!StringUtils.isBlank(error)) { |
| | | throw new VciBaseException("当前设置的密码,密码策略校验未通过!"); |
| | | } |
| | | |
| | | //TODO:考虑是否需要将修改方式改成直接调用平台的接口,因为现在的修改方式没能正确的更新缓存 |
| | | /*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 + "', plpwdupdatetime = TO_DATE('" |
| | | + Func.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"','yyyy-MM-dd hh24:mi:ssxff') where pluid = '" + userOid.trim() + "'"; |
| | | + Func.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"','yyyy-MM-dd hh24:mi:ss') where pluid = '" + userOid.trim() + "'"; |
| | | try { |
| | | return platformClientUtil.getBOFactoryService().executeUpdateSql(sql); |
| | | } catch (PLException vciError) { |
| | |
| | | // 设置表单列名 |
| | | 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("账号", "密码", "姓名", "电子邮箱", "专业", "描述", "部门(上下级部门之间以反斜杠隔开(/))" ,"密级")); |
| | | } |
| | |
| | | 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()); |
| | | //是否必须导入密级 |
| | |
| | | //当前excel中是否重复用的判重Map:(key:账号,value:行号) |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //先获取全部部门名称的父子对应关系:key为部门子父级名称路径,value为部门信息 |
| | | 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 -> { |