ÎļþÃû´Ó Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.vci.frameworkcore.compatibility.impl; |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.common.util.ThreeDES; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.framework.data.DeptInfo; |
| | | import com.vci.corba.framework.data.RoleInfo; |
| | | import com.vci.corba.framework.data.UserInfo; |
| | | import com.vci.corba.framework.data.UserLogonInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.etm.EnumItem; |
| | | import com.vci.corba.omd.etm.EnumType; |
| | | 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.corba.framework.data.UserInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI; |
| | | import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.enumpck.OrgTypeEnum; |
| | | import com.vci.enumpck.UI.OrgTypeEnum; |
| | | import com.vci.enumpck.UserTypeEnum; |
| | | import com.vci.model.SmUserDO; |
| | | import com.vci.pagemodel.SmUserVO; |
| | | import com.vci.po.SmUserPO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | 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.pagemodel.SmUserVO; |
| | | import com.vci.po.SmUserPO; |
| | | import com.vci.properties.OsConfig; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | | import com.vci.starter.poi.bo.WriteExcelOption; |
| | |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.*; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.starter.web.util.Lcm.Func; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.enumpck.UserTypeEnum; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import java.io.File; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.web.util.WebUtil.arryAndSqlToBusinessObject; |
| | | |
| | | /** |
| | | * ç¨æ·çæ¥è¯¢ç¸å
³çæå¡ï¼å¯ä»¥å
¼å®¹èå¹³å°åèçpdm |
| | |
| | | * å¯ç çç¥æ¥è¯¢æå¡ |
| | | */ |
| | | @Autowired |
| | | private SmPwdStrategyQueryServiceI smPwdStrategyQueryService; |
| | | private WebPwdStrategyQueryServiceI smPwdStrategyQueryService; |
| | | |
| | | /** |
| | | * 使ç¨è§è²ç屿§æ¥è¯¢ç¨æ·æ¶ |
| | |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * å¹³å°é
ç½® |
| | | */ |
| | | private OsConfig osConfig; |
| | | |
| | | /** |
| | | * æ£æ¥ç¨æ·æ¯å¦åå¨ï¼å¯ä»¥æ ¹æ®ç¨æ·åï¼ä¹å¯ä»¥æ ¹æ®ç¨æ·oid |
| | |
| | | try{ |
| | | String[][] sqlQueryResult = platformClientUtil.getBOFService().getSqlQueryResult(sql + fromSql, null); |
| | | if(sqlQueryResult.length>0){ |
| | | BusinessObject cbo = arryAndSqlToBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); |
| | | BusinessObject cbo = WebUtil.arryAndSqlToBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); |
| | | return cbo2VO(cbo); |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
æ°æ®åºåå¨é®é¢çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserByUserIds(Collection<String> userIdCollections)throws VciBaseException { |
| | | public List<SmUserVO> listUserByUserIds(Collection<String> userIdCollections) { |
| | | WebUtil.alertNotNull(userIdCollections,"ç¨æ·åéå"); |
| | | try { |
| | | UserInfo[] userInfo = platformClientUtil.getFrameworkService().fetchUserInfoByNames(VciBaseUtil.collection2StrArr(userIdCollections)); |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
æ°æ®åºåå¨é®é¢çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public SmUserVO getUserByUserOid(String userOid) throws VciBaseException { |
| | | public SmUserVO getUserByUserOid(String userOid) { |
| | | WebUtil.alertNotNull(userOid,"ç¨æ·ä¸»é®"); |
| | | try { |
| | | UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(userOid); |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
æ°æ®åºåå¨é®é¢çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserByUserOids(Collection<String> userOidCollections) throws VciBaseException { |
| | | public List<SmUserVO> listUserByUserOids(Collection<String> userOidCollections) { |
| | | WebUtil.alertNotNull(userOidCollections,"ç¨æ·ä¸»é®éå"); |
| | | try { |
| | | UserInfo[] userInfoArr = platformClientUtil.getFrameworkService().getUserObjectByoids(VciBaseUtil.collection2StrArr(userOidCollections)); |
| | |
| | | */ |
| | | private SmUserVO smUserDO2VO(SmUserDO smUserDO){ |
| | | SmUserVO smUserVO = new SmUserVO(); |
| | | BeanUtil.convert(smUserDO,smUserVO); |
| | | BeanUtilForVCI.convert(smUserDO,smUserVO); |
| | | return smUserVO; |
| | | } |
| | | |
| | |
| | | }else{ |
| | | userDO.setLockFlag(BooleanEnum.TRUE.getValue()); |
| | | } |
| | | BeanUtil.convert(userDO,userVO); |
| | | BeanUtilForVCI.convert(userDO,userVO); |
| | | return userVO; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<SmUserVO> getDataGridUsers(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException { |
| | | public DataGrid<SmUserVO> getDataGridUsers(Map<String, String> conditionMap, PageHelper pageHelper) { |
| | | if(pageHelper == null){ |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | pageHelper.addDefaultAsc("PLTRUENAME"); |
| | | String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | //String loginUserId = "Ludc"; |
| | | //å页æ¥è¯¢ |
| | | UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoByCondition( |
| | | conditionMap.get("name"), |
| | | conditionMap.get("id"), |
| | | conditionMap.get("pkDepartment"), |
| | | conditionMap.get("pkPerson"), |
| | | loginUserId, //å½åç»å½çç¨æ·å |
| | | pageHelper.getPage(), |
| | | pageHelper.getLimit() |
| | | ); |
| | | DataGrid<SmUserVO> dataGrid = new DataGrid<>(); |
| | | if(Func.isNotEmpty(userInfos)){ |
| | | List<String> idList = Arrays.stream(userInfos).map(item -> item.id).collect(Collectors.toList()); |
| | | orgDepartmentVOMap = orgDeptQueryService.batchMapDeptNameByUserOids(idList, null); |
| | | smRoleVOMap = smRoleQueryService.batchListRoleByUserOids(idList,null); |
| | | smPwdStrategyVOMap = smPwdStrategyQueryService.batchSmPwdStrategyByUserOids(idList); |
| | | dataGrid.setData(userInfoArr2VO(userInfos)); |
| | | //ç¨å®äºæ¸
空 |
| | | orgDepartmentVOMap = null; |
| | | smRoleVOMap = null; |
| | | smPwdStrategyVOMap = null; |
| | | //TODO: è¿ä¸ªç»è®¡æ»æ°æé®é¢ï¼å¸¦è¿å»çåæ°ä¸è½åä¸é¢é£ä¸ªfetchUserInfoByConditionæ¥è¯¢ä¸æ ·ç»è®¡çå´çæ»æ° |
| | | dataGrid.setTotal( |
| | | platformClientUtil.getFrameworkService().getUserTotalByCondition( |
| | | conditionMap.get("name"), |
| | | conditionMap.get("id"), |
| | | conditionMap.get("pkDepartment"), |
| | | conditionMap.get("pkPerson"), |
| | | loginUserId //å½åç»å½çç¨æ·å |
| | | ) |
| | | DataGrid<SmUserVO> dataGrid = null; |
| | | try { |
| | | //String loginUserId = "Ludc"; |
| | | //å页æ¥è¯¢ |
| | | UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoByCondition( |
| | | conditionMap.get("name"), |
| | | conditionMap.get("id"), |
| | | conditionMap.get("pkDepartment"), |
| | | conditionMap.get("pkPerson"), |
| | | loginUserId, //å½åç»å½çç¨æ·å |
| | | pageHelper.getPage(), |
| | | pageHelper.getLimit() |
| | | ); |
| | | dataGrid = new DataGrid<>(); |
| | | if(Func.isNotEmpty(userInfos)){ |
| | | List<String> idList = Arrays.stream(userInfos).map(item -> item.id).collect(Collectors.toList()); |
| | | orgDepartmentVOMap = orgDeptQueryService.batchMapDeptNameByUserOids(idList, null); |
| | | smRoleVOMap = smRoleQueryService.batchListRoleByUserOids(idList,null); |
| | | smPwdStrategyVOMap = smPwdStrategyQueryService.batchSmPwdStrategyByUserOids(idList); |
| | | dataGrid.setData(userInfoArr2VO(userInfos)); |
| | | //ç¨å®äºæ¸
空 |
| | | orgDepartmentVOMap = null; |
| | | smRoleVOMap = null; |
| | | smPwdStrategyVOMap = null; |
| | | //TODO: è¿ä¸ªç»è®¡æ»æ°æé®é¢ï¼å¸¦è¿å»çåæ°ä¸è½åä¸é¢é£ä¸ªfetchUserInfoByConditionæ¥è¯¢ä¸æ ·ç»è®¡çå´çæ»æ° |
| | | dataGrid.setTotal( |
| | | platformClientUtil.getFrameworkService().getUserTotalByCondition( |
| | | conditionMap.get("name"), |
| | | conditionMap.get("id"), |
| | | conditionMap.get("pkDepartment"), |
| | | conditionMap.get("pkPerson"), |
| | | loginUserId //å½åç»å½çç¨æ·å |
| | | ) |
| | | ); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("è·åç¨æ·å表失败ï¼", new Object[]{}, e); |
| | | } |
| | | return dataGrid; |
| | | } |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> countSmUserByDeptOid(String deptOid, Map<String, String> queryMap) throws VciBaseException { |
| | | public List<SmUserVO> countSmUserByDeptOid(String deptOid, Map<String, String> queryMap) { |
| | | //æ¯å¦æ¥è¯¢åé¨é¨ä¸å
³èçç¨æ· |
| | | List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.listAllLevelChildrenDeptByParentOid(deptOid, null); |
| | | List<String> deptOidCollection = orgDepartmentVOList.stream().map(OrgDepartmentVO::getOid).collect(Collectors.toList()); |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserByDeptOid(String deptOid, Map<String, String> queryMap) throws VciBaseException { |
| | | public List<SmUserVO> listUserByDeptOid(String deptOid, Map<String, String> queryMap) { |
| | | //æ¥è¯¢å½åéä¸çé¨é¨ä¸çç¨æ· |
| | | return listUserVOByDeptOid(queryMap,Arrays.asList(deptOid),false ); |
| | | } |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserUnInDeptOid(String deptOid, Map<String, String> queryMap) throws VciBaseException { |
| | | public List<SmUserVO> listUserUnInDeptOid(String deptOid, Map<String, String> queryMap) { |
| | | // TODO:æ ¹æ®å½åç»å½çç¨æ·å³å®è½æ¥é£äºç¨æ· |
| | | String userType = "0";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUsertype(); |
| | | //æ ¹æ®å½åç»å½çç¨æ·ç±»åä¸åï¼æ¥è¯¢ä¸åçç¨æ· |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, List<SmUserVO>> batchListUserByDeptOids( |
| | | Collection<String> deptOidCollection) throws VciBaseException { |
| | | Collection<String> deptOidCollection) { |
| | | if(CollectionUtils.isEmpty(deptOidCollection)){ |
| | | return new HashMap<>(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserByRoleOid(String roleOid, |
| | | Map<String, String> queryMap) throws VciBaseException { |
| | | Map<String, String> queryMap) { |
| | | return listUserVOByRoleOid(queryMap,roleOid,false); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<SmUserVO> listUserUnInRoleOid(String roleOid, |
| | | Map<String, String> queryMap) throws VciBaseException { |
| | | Map<String, String> queryMap) { |
| | | // TODO:æ ¹æ®å½åç»å½çç¨æ·å³å®è½æ¥é£äºç¨æ· |
| | | String usertype = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUsertype(); |
| | | //æ ¹æ®å½åç»å½çç¨æ·ç±»åä¸åï¼æ¥è¯¢ä¸åçç¨æ· |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, List<SmUserVO>> batchListUserByRoleOids( |
| | | Collection<String> roleOidCollection) throws VciBaseException { |
| | | Collection<String> roleOidCollection) { |
| | | if(CollectionUtils.isEmpty(roleOidCollection)){ |
| | | return new HashMap<>(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid<SmUserVO> refGridUsers(Map<String, String> queryMap, |
| | | PageHelper pageHelper) throws VciBaseException { |
| | | PageHelper pageHelper) { |
| | | return gridUserByQueryField(null,null,queryMap,pageHelper,false); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<Tree> refTreeUsers(TreeQueryObject treeQueryObject) |
| | | throws VciBaseException { |
| | | public List<Tree> refTreeUsers(TreeQueryObject treeQueryObject) { |
| | | VciQueryWrapperForDO queryWrapper = getQueryWrapper(null, null, treeQueryObject.getConditionMap(), null, false); |
| | | queryWrapper.wrapperSql(); |
| | | String sql = queryWrapper.getSelectFieldSql(); |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public List<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject) throws VciBaseException { |
| | | public List<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject) { |
| | | List<Tree> rootTreeList=new ArrayList<>(); |
| | | Map<String,String> conditionMap=treeQueryObject.getConditionMap(); |
| | | if(CollectionUtils.isEmpty(conditionMap)) { |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
åå¨å°æ°æ®åºä¸åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void updateUserPwdWrongCount(String userOid, int wrongCount) |
| | | throws VciBaseException { |
| | | public void updateUserPwdWrongCount(String userOid, int wrongCount){ |
| | | WebUtil.alertNotNull(userOid,"ç¨æ·ä¸»é®"); |
| | | String sql = "update pllogoninfo set plwrongnum = " + wrongCount +" where pluserid ='" + userOid + "'"; |
| | | try { |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void updateUserLoginTime(String userOid) throws VciBaseException { |
| | | public void updateUserLoginTime(String userOid) { |
| | | WebUtil.alertNotNull(userOid,"ç¨æ·ä¸»é®"); |
| | | String sql = "update pllogoninfo set pllogontime = sysdate where pluserid ='" + userOid + "'"; |
| | | try { |
| | |
| | | // 设置表ååå |
| | | List<String> columns = new ArrayList<>(Arrays.asList("è´¦å·", "å¯ç ", "å§å", "çµåé®ç®±", "ä¸ä¸", "æè¿°", "é¨é¨(ä¸ä¸çº§é¨é¨ä¹é´ä»¥åææ éå¼(/))")); |
| | | //è·åæ¯å¦å¯¼åºå¯çº§é
置项 |
| | | String flag = ConfigCorbaReader.getConfigValue("exportSecretGrade"); |
| | | if (flag != null && flag.equalsIgnoreCase("true")) { |
| | | if (osConfig.isExportSecretGrade()) { |
| | | columns = new ArrayList<>(Arrays.asList("è´¦å·", "å¯ç ", "å§å", "çµåé®ç®±", "ä¸ä¸", "æè¿°", "é¨é¨(ä¸ä¸çº§é¨é¨ä¹é´ä»¥åææ éå¼(/))" ,"å¯çº§")); |
| | | } |
| | | //设置å¿
å¡«å |
| | |
| | | String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null); |
| | | //æ¯å¦å¯¼å
¥å¯çº§é
ç½® |
| | | boolean exportSecretGrade = Boolean.parseBoolean(ConfigCorbaReader.getConfigValue("exportSecretGrade")); |
| | | boolean exportSecretGrade = osConfig.isExportSecretGrade(); |
| | | List<SmUserPO> poList = ExcelUtil.readDataObjectFromExcel(file, SmUserPO.class,excelOption,(value, po, fieldName)->{ |
| | | Integer secretValue = UserSecretEnum.getSecretValueByText(po.getSecretGradeText()); |
| | | //æ¯å¦å¿
须导å
¥å¯çº§ |
| | |
| | | //ä¿åé»è¾ |
| | | poList.stream().forEach(smUserPO->{ |
| | | SmUserDTO smUserDTO = new SmUserDTO(); |
| | | BeanUtil.convert(smUserPO,smUserDTO); |
| | | BeanUtilForVCI.convert(smUserPO,smUserDTO); |
| | | //ç¨æ·ä¿¡æ¯æ¯å¦è§èæ£æ¥ |
| | | this.check(smUserDTO,true,true); |
| | | //çæåå¨çDO对象 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> queryUserNameByRoleType(String roleType) throws PLException { |
| | | public List<String> queryUserNameByRoleType(String roleType) { |
| | | List<String> userNameList = new ArrayList<>(); |
| | | if(Func.isBlank(roleType)){ |
| | | return userNameList; |