| | |
| | | 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; |
| | |
| | | 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.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.ConfigReader; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | |
| | | * @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); |
| | |
| | | /** |
| | | * 修改密码 |
| | | * @param userOid 用户主键 |
| | | * @param oldPassword 旧的密码 |
| | | * @param password 新的密码 |
| | | * @param confirmPassword 确认密码 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void changePassword(String userOid, String password, |
| | | public boolean changePassword(String userOid,String oldPassword, String password, |
| | | String confirmPassword) throws PLException { |
| | | WebUtil.alertNotNull(userOid,"用户主键",password,"密码",confirmPassword,"确认密码"); |
| | | WebUtil.alertNotNull(userOid,"用户主键",oldPassword,"登录密码",password,"密码",confirmPassword,"确认密码"); |
| | | //对比旧密码 |
| | | boolean b = this.checkPasswordEqual(oldPassword, userOid); |
| | | if(!b){ |
| | | throw new PLException("500", new String[] { "您输入的密码与登录密码不一致,请重新输入!"}); |
| | | } |
| | | if(!password.equals(confirmPassword)){ |
| | | throw new VciBaseException("密码和确认密码不相等"); |
| | | } |
| | |
| | | //TODO:校验密码是否符合策略 |
| | | String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(smUserVO.getId(), password,null); |
| | | if (!StringUtils.isBlank(error)) { |
| | | throw new VciBaseException("当前设置的密码,密码策略校验未通过"); |
| | | throw new VciBaseException("当前设置的密码,密码策略校验未通过!"); |
| | | } |
| | | ThreeDES des = new ThreeDES();// 实例化一个对�? |
| | | des.getKey("daliantan0v0");// 生成密匙 |
| | | String encPassword = des.getEncString(password); |
| | | |
| | | //修改密码的同时需要将密码修改时间也更新 |
| | | String sql = "update pluser set plpassword = '" + encPassword + "' plpwdupdatetime = '"+ System.currentTimeMillis() +"' 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:ssxff') where pluid = '" + userOid.trim() + "'"; |
| | | try { |
| | | platformClientUtil.getBOFactoryService().executeUpdateSql(sql); |
| | | return platformClientUtil.getBOFactoryService().executeUpdateSql(sql); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |