From 5acc490fa6f77a9ed7b5976ee6a2e22b070df5bf Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 09 七月 2024 09:49:36 +0800 Subject: [PATCH] 角色管理联调修改、部门管理接口等代码上传 --- Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java | 15 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java | 376 ++++++++++++++++++++++++-- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java | 71 ++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/dto/OrgDepartmentDTO.java | 4 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java | 54 +++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/po/OrgDeptPO.java | 72 +++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 50 ++- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java | 22 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/OrgDeptForPlatform1.java | 38 ++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java | 33 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java | 24 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmRoleQueryServiceI.java | 11 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/OrgDepartmentVO.java | 69 ++++ 13 files changed, 755 insertions(+), 84 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java index 0810fed..6d17c4f 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java @@ -1,6 +1,8 @@ package com.vci.starter.web.util; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.vci.common.exception.VciExceptionTool; @@ -81,6 +83,19 @@ } /** + * 闆姳ID + * @return + */ + public static String getSnowflakePk() { + return String.valueOf(getSnowflakePk(1,1)); + } + + public static Long getSnowflakePk(long workerId,long dataCenterId){ + Snowflake snowflake = IdUtil.getSnowflake(workerId,dataCenterId); + return snowflake.nextId(); + } + + /** * 瀛楃涓茶浆鏁板瓧 * @param string 瀛楃涓� * @return 鏁板瓧 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java index bba3844..605caf1 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java @@ -4,11 +4,9 @@ import com.vci.frameworkcore.model.dto.OrgDepartmentDTO; import com.vci.frameworkcore.pagemodel.OrgDepartmentVO; import com.vci.starter.web.exception.VciBaseException; -import com.vci.starter.web.pagemodel.DataGrid; -import com.vci.starter.web.pagemodel.PageHelper; -import com.vci.starter.web.pagemodel.Tree; -import com.vci.starter.web.pagemodel.TreeQueryObject; +import com.vci.starter.web.pagemodel.*; +import java.io.File; import java.util.Collection; import java.util.List; import java.util.Map; @@ -35,7 +33,7 @@ * @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯� * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父 */ - OrgDepartmentVO getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException; + List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException; /** * 鎵归噺鑾峰彇閮ㄩ棬鐨勪俊鎭� 锛堟牴鎹儴闂ㄤ富閿級 @@ -90,9 +88,17 @@ * 鎵归噺鏍规嵁鐢ㄦ埛鐨勪富閿潵鑾峰彇閮ㄩ棬 * @param userOidCollection 鐢ㄦ埛涓婚敭闆嗗悎 * @param queryMap 鏌ヨ鏉′欢锛屽鏋滈渶瑕佷娇鐢ㄧ敤鎴风殑灞炴�ф潵鏌ヨ鍙互浣跨敤pkUser.xxxx - * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄繖涓敤鎴峰叧鑱旂殑閮ㄩ棬 + * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄叧鑱旂殑閮ㄩ棬 */ Map<String,List<OrgDepartmentVO>> batchListDeptByUserOids(Collection<String> userOidCollection, Map<String, String> queryMap); + + /** + * 鎵归噺鏍规嵁鐢ㄦ埛鐨勪富閿潵鑾峰彇閮ㄩ棬鍚嶇О锛�/闂撮殧鏂瑰紡锛� + * @param userOidCollection 鐢ㄦ埛涓婚敭闆嗗悎 + * @param queryMap 鏌ヨ鏉′欢锛屽鏋滈渶瑕佷娇鐢ㄧ敤鎴风殑灞炴�ф潵鏌ヨ鍙互浣跨敤pkUser.xxxx + * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄叧鑱旂殑閮ㄩ棬锛坘ey:鍏宠仈鐨勯儴闂╫id,value:鍖呭惈鐖惰妭鐐瑰褰撳墠閮ㄩ棬涓轰汉鍔涜祫婧愰儴鍒欏�间负锛�550/浜哄姏璧勬簮閮級 + */ + Map<String,Map<String,String>> batchMapDeptNameByUserOids(Collection<String> userOidCollection, Map<String, String> queryMap); /** * 鑾峰彇鏌愪釜閮ㄩ棬鐨勭洿灞炰笅绾ч儴闂� @@ -159,4 +165,19 @@ */ Map<String,OrgDepartmentVO> getDeptAllTreeMap(); + /** + * 涓嬭浇瀵煎叆閮ㄩ棬鐨別xcel妯℃澘銆� + * @param downloadFileName + * @return + */ + String downloadImportTemplate(String downloadFileName); + + /** + * 瀵煎叆閮ㄩ棬 + * @param file + * @return + * @throws VciBaseException + */ + BaseResult importDept(File file) throws VciBaseException; + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmRoleQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmRoleQueryServiceI.java index de158ff..bf6993e 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmRoleQueryServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmRoleQueryServiceI.java @@ -182,11 +182,20 @@ BaseResult importRole(File file) throws VciBaseException; /** - * 淇濆瓨鐢ㄦ埛瑙掕壊鍏宠仈鍏崇郴 + * 鎴愬憳绠$悊鍒嗛厤瑙掕壊璋冪敤锛屼繚瀛樼敤鎴疯鑹插叧鑱斿叧绯� * @param userOids * @param roleIds * @return */ boolean saveRights(String[] userOids, String[] roleIds) throws PLException; + /** + * 瑙掕壊绠$悊鍒嗛厤鎴愬憳鎺ュ彛璋冪敤 + * @param userOids + * @param roleId + * @return + * @throws PLException + */ + boolean saveRight(String[] userOids, String roleId) throws PLException; + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java index 22618bc..35748de 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java @@ -8,26 +8,44 @@ import com.vci.frameworkcore.model.dto.OrgDepartmentDTO; import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; import com.vci.frameworkcore.model.OrgDeptForPlatform1; +import com.vci.frameworkcore.model.dto.SmUserDTO; +import com.vci.frameworkcore.model.po.OrgDeptPO; +import com.vci.frameworkcore.model.po.SmUserPO; import com.vci.frameworkcore.pagemodel.OrgDepartmentVO; +import com.vci.frameworkcore.pagemodel.SmUserVO; +import com.vci.frameworkcore.properties.ConfigReader; import com.vci.omd.utils.ObjectTool; +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.poi.constant.ExcelLangCodeConstant; +import com.vci.starter.poi.util.ExcelUtil; import com.vci.starter.revision.bo.TreeWrapperOptions; import com.vci.starter.revision.service.RevisionModelUtil; import com.vci.starter.web.constant.QueryOptionConstant; +import com.vci.starter.web.enumpck.UserSecretEnum; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; -import com.vci.starter.web.util.BeanUtil; -import com.vci.starter.web.util.VciBaseUtil; +import com.vci.starter.web.util.*; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.service.WebBoServiceI; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.util.HSSFColor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.web.util.WebUtils; +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -59,6 +77,16 @@ private RevisionModelUtil revisionModelUtil; /** + * 蹇呭~鍒� + */ + private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>(); + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** * 鏍规嵁閮ㄩ棬涓婚敭鑾峰彇閮ㄩ棬鐨勪俊鎭� * @param deptOid 閮ㄩ棬涓婚敭 * @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯� @@ -69,8 +97,14 @@ if(StringUtils.isBlank(deptOid)){ return null; } - OrgDeptForPlatform1 deptForPlatform1 = boService.selectByOid(deptOid, OrgDeptForPlatform1.class); - return deptDO2VO(deptForPlatform1); + Map<String, String> conditionMap = new HashMap<>(); + conditionMap.put("pluid",deptOid); + VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(conditionMap,OrgDeptForPlatform1.class); + List<OrgDeptForPlatform1> deptForPlatform1s = boService.selectByQueryWrapper(queryWrapper, OrgDeptForPlatform1.class); + if(Func.isEmpty(deptForPlatform1s)){ + return null; + } + return deptDO2VO(deptForPlatform1s.get(0)); } /** @@ -81,11 +115,11 @@ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public OrgDepartmentVO getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException { + public List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException { if(Func.isEmpty(conditionMap)){ conditionMap = new HashMap(); } - VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(new HashMap<>(),OrgDeptForPlatform1.class); + VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(conditionMap,OrgDeptForPlatform1.class); //鐖朵富閿负绌烘煡椤跺眰 if(Func.isBlank(parentDeptOid)){ queryWrapper.isNull("plparentuid"); @@ -96,7 +130,7 @@ if(Func.isEmpty(roleForPlatform1s)){ return null; } - return deptDO2VO(roleForPlatform1s.get(0)); + return deptDO2VOs(roleForPlatform1s); } /** @@ -121,18 +155,23 @@ OrgDepartmentVO departmentVO = new OrgDepartmentVO(); if(deptForPlatform1!=null){ departmentVO.setOid(deptForPlatform1.getPluid()); + // 闄ら儴闂ㄤ富閿鐨勫敮涓�鏍囪瘑锛岄暱搴︿负Dept:+8浣嶅彲閫氳繃璇ュ弬鏁板弽鎺ㄥ洖閮ㄩ棬涓婚敭鐨刪ash缂栫爜 + departmentVO.setUniqueId("Dept:"+Func.oidEnHash(deptForPlatform1.getPluid())); departmentVO.setId(deptForPlatform1.getPlnum()); departmentVO.setName(deptForPlatform1.getPlname()); + departmentVO.setStatus(deptForPlatform1.getPlstatus()); if(0 == deptForPlatform1.getPlstatus()){ - departmentVO.setLcStatus(FrameworkDataLCStatus.ENABLED.getValue()); + departmentVO.setStatusText(FrameworkDataLCStatus.ENABLED.getValue()); }else{ - departmentVO.setLcStatus(FrameworkDataLCStatus.DISABLED.getValue()); + departmentVO.setStatusText(FrameworkDataLCStatus.DISABLED.getValue()); } + departmentVO.setSpecialties(deptForPlatform1.getPlspecialties()); + departmentVO.setCode(deptForPlatform1.getPlcode()); departmentVO.setPkFatherDepartment(deptForPlatform1.getPlparentuid()); departmentVO.setDescription(deptForPlatform1.getPldesc()); - departmentVO.setCheckInTime(deptForPlatform1.getPlcreatetime()); + departmentVO.setCreateTime(new Date(deptForPlatform1.getPlcreatetime())); departmentVO.setCreator(deptForPlatform1.getPlcreateuser()); - departmentVO.setLastModifyTime(deptForPlatform1.getPlupdatetime()); + departmentVO.setLastModifyTime(new Date(deptForPlatform1.getPlupdatetime())); departmentVO.setLastModifier(deptForPlatform1.getPlupdateuser()); } return departmentVO; @@ -312,7 +351,7 @@ * 鎵归噺鏍规嵁鐢ㄦ埛鐨勪富閿潵鑾峰彇閮ㄩ棬 * @param userOidCollection 鐢ㄦ埛涓婚敭闆嗗悎 * @param queryMap 鏌ヨ鏉′欢锛屽鏋滈渶瑕佷娇鐢ㄧ敤鎴风殑灞炴�ф潵鏌ヨ鍙互浣跨敤pkUser.xxxx - * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄繖涓敤鎴峰叧鑱旂殑閮ㄩ棬 + * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄叧鑱旂殑閮ㄩ棬 */ @Override public Map<String, List<OrgDepartmentVO>> batchListDeptByUserOids( @@ -342,7 +381,6 @@ //杩欏効搴旇瀵筪eptVOList鍋氫竴娆″幓閲嶅鐞嗭紝鍥犱负鑲畾浼氭湁閲嶅鐨勯儴闂ㄨ鏌ュ嚭鏉� Map<String, OrgDepartmentVO> deptVOMap = deptVOList.stream() .collect(Collectors.toMap(OrgDepartmentVO::getOid, Function.identity(), (existing, replacement) -> existing)); - //Map<String, OrgDepartmentVO> deptVOMap = deptVOList.stream().distinct().collect(Collectors.toMap(s -> s.getOid(), t -> t)); Map<String, List<OrgDepartmentVO>> userDeptVOMap = new HashMap<>(); userDeptOidMap.forEach((userOid,deptOids)->{ List<OrgDepartmentVO> deptVOS = new ArrayList<>(); @@ -358,7 +396,63 @@ return new HashMap<>(); } - /** + /** + * 鎵归噺鏍规嵁鐢ㄦ埛鐨勪富閿潵鑾峰彇閮ㄩ棬鍚嶇О锛�/闂撮殧鏂瑰紡锛� + * @param userOidCollection 鐢ㄦ埛涓婚敭闆嗗悎 + * @param queryMap 鏌ヨ鏉′欢锛屽鏋滈渶瑕佷娇鐢ㄧ敤鎴风殑灞炴�ф潵鏌ヨ鍙互浣跨敤pkUser.xxxx + * @return 閮ㄩ棬鐨勬樉绀哄璞★紝key鏄敤鎴蜂富閿�,value鏄叧鑱旂殑閮ㄩ棬锛堝寘鍚埗鑺傜偣濡傚綋鍓嶉儴闂ㄤ负浜哄姏璧勬簮閮ㄥ垯鍊间负锛�550/浜哄姏璧勬簮閮級 + */ + @Override + public Map<String,Map<String,String>> batchMapDeptNameByUserOids(Collection<String> userOidCollection, Map<String, String> queryMap) { + if(CollectionUtils.isEmpty(userOidCollection)){ + return new HashMap<>(); + } + Map<String,Map<String,String>> deptOidNameMap = new HashMap<>(); + Map<String,Map<String,String>> userDeptOidMap = new HashMap<>(); + WebUtil.switchCollectionForOracleIn(userOidCollection).stream().forEach(userOids->{ + //1銆佽鍏堟牴鎹敤鎴蜂富閿幏鍙栧埌鍏宠仈鐨勯儴闂ㄤ富閿� + String sql = "select pluseruid,pldeptuid from pluserdept where pluseruid in (" + WebUtil.toInSql(userOids.toArray(new String[0])) + ")"; + List<BusinessObject> cbos = boService.queryBySql(sql, null); + if(!CollectionUtils.isEmpty(cbos)){ + cbos.stream().forEach(cbo->{ + //瑙掕壊涓婚敭 + String userOid = ObjectTool.getNewBOAttributeValue(cbo,"pluseruid"); + //閮ㄩ棬涓婚敭 + String deptUid = ObjectTool.getNewBOAttributeValue(cbo, "pldeptuid"); + //2銆佺劧鍚庢牴鎹儴闂ㄤ富閿幏鍙栧埌鐢遍儴闂ㄥ悕绉�/缁勬垚鐨勫�� + //閬垮厤澶氭鏌ヨ锛屾垨鑰呭惊鐜煡璇� + if(deptOidNameMap.containsKey(deptUid)){ + userDeptOidMap.put(userOid,deptOidNameMap.get(deptUid)); + }else { + if(Func.isNotEmpty(deptUid)){ + //2.1銆佹煡璇㈤儴闂╫id锛屽綋鍓嶉儴闂ㄥ寘鍚埗閮ㄩ棬 + String queryDeptSql = "select pluid,plname from pldept START with pluid = '" + + deptUid + "' connect by prior plparentuid = pluid"; + List<BusinessObject> cboDepts = boService.queryBySql(queryDeptSql, null); + if(!CollectionUtils.isEmpty(cboDepts)){ + StringBuilder sb = new StringBuilder(); + for (int i = cboDepts.size()-1; i >=0; i--) { + String deptName = ObjectTool.getNewBOAttributeValue(cboDepts.get(i),"plname"); + sb.append(deptName); + sb.append("/"); + } + //2.2銆侀伩鍏嶅悓涓�閮ㄩ棬澶氭鏌ヨ锛岃繖閲屽瓨鍌ㄥ湪涓�涓叕鍏遍泦鍚堜腑锛屼究浜庨噸澶嶄娇鐢� + //鍒犻櫎鏈�鍚庝竴涓枩鏉� + sb.deleteCharAt(sb.length() - 1); + Map<String,String> tempMap = new HashMap<>(); + tempMap.put(deptUid,sb.toString()); + deptOidNameMap.put(deptUid,tempMap); + userDeptOidMap.put(userOid,tempMap); + } + } + } + }); + } + }); + return userDeptOidMap; + } + + /** * 鑾峰彇鏌愪釜閮ㄩ棬鐨勭洿灞炰笅绾ч儴闂� * @param pkFatherDepartmment 閮ㄩ棬鐨勪富閿� * @param queryMap 鏌ヨ鏉′欢 @@ -400,6 +494,7 @@ public List<Tree> refTreeDept(TreeQueryObject treeQueryObject) { String pkFatherDepartmment=treeQueryObject.getParentOid(); Map<String, String> conditionMap = treeQueryObject.getConditionMap(); + Map<String, String> extandParamsMap = treeQueryObject.getExtandParamsMap(); if(conditionMap==null){ conditionMap=new HashMap<String, String>(); } @@ -414,9 +509,27 @@ TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(); BeanUtil.convert(treeQueryObject,treeWrapperOptions); treeWrapperOptions.setParentFieldName("pkFatherDepartment"); - return revisionModelUtil.doList2Trees(orgDepartmentVOList,treeWrapperOptions,dept->{ - return dept.getId() + " " + dept.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equals(dept.getLcStatus())?"銆愬仠鐢ㄣ��":""); + List<Tree> trees = revisionModelUtil.doList2Trees(orgDepartmentVOList, treeWrapperOptions, dept -> { + return dept.getId() + " " + dept.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equals(dept.getLcStatus()) ? "銆愬仠鐢ㄣ��" : ""); }); + //extandParamsMap涓坊鍔�"showAllDepartmentNode"涓�"true"鏃�,骞朵笖parentOid涓虹┖锛岃繑鍥炵粨鏋滀腑浼氬寘鍚�滄墍鏈夐儴闂ㄢ�濊繖涓妭鐐� + if(Func.isBlank(pkFatherDepartmment) && (Func.isNotEmpty(extandParamsMap) && Boolean.parseBoolean(extandParamsMap.getOrDefault("showAllDepartmentNode","false")))){ + List<Tree> treeList = new ArrayList<>(); + Tree tree = new Tree(); + tree.setLeaf(false); + tree.setParentId(null); + //娌℃湁瀹為檯浣滅敤鍙槸鐣岄潰涓婃覆鏌撲娇鐢� + tree.setOid(UUID.randomUUID().toString()); + tree.setParentName(null); + Map<String, String> map = new HashMap<>(); + map.put("name","鎵�鏈夐儴闂�"); + map.put("ALLDept","ALLDept"); + tree.setAttributes(map); + tree.setChildren(trees); + treeList.add(tree); + return treeList; + } + return trees; } /** @@ -476,7 +589,7 @@ tempList.removeAll(repeatUserOidList); userOIds = tempList.toArray(new String[tempList.size()]); if(Func.isNotEmpty(userOIds)){ - platformClientUtil.getFrameworkService().saveUserDept(userOIds, deptId,null); + platformClientUtil.getFrameworkService().saveUserDept(userOIds, deptId,new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(),null)); } return true; } @@ -492,16 +605,18 @@ VciBaseUtil.alertNotNull( orgDepartmentDTO,"娣诲姞鐨勯儴闂ㄥ璞�", orgDepartmentDTO.getName(),"閮ㄩ棬鍚�"); - //閮ㄩ棬鍚嶅垽閲� + //閮ㄩ棬鍚嶅拰缂栧彿鍒ら噸 Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("plname",orgDepartmentDTO.getName()); - conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId()); - OrgDepartmentVO departmentVO = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap); - if(Func.isNotEmpty(departmentVO)){ + conditionMap.put("plname",QueryOptionConstant.OR + orgDepartmentDTO.getName()); + if(Func.isNotBlank(orgDepartmentDTO.getId())){ + conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId()); + } + List<OrgDepartmentVO> departmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap); + if(Func.isNotEmpty(departmentVOS)){ throw new VciBaseException("鍚屼竴鐖惰妭鐐逛笅璇ラ儴闂ㄥ悕绉版垨缂栧彿宸茬粡瀛樺湪,璇蜂慨鏀�!"); } - //SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); - String userId = "developer";//loginUser.getUserId(); + SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); + String userId = loginUser.getUserId(); //鐢熸垚瀛樺偍鐨刢orba瀵硅薄 orgDepartmentDTO.setCreateTime(new Date()); @@ -531,18 +646,37 @@ orgDepartmentDTO.getId(),"鐢ㄦ埛鍚�" ); //鎸塷id鏌ヨ鏁版嵁搴撲腑宸插瓨鍦ㄧ殑 - OrgDepartmentVO departmentVO = getDeptByDeptOid(orgDepartmentDTO.getOid()); - //鏍规嵁涓婚敭娌℃煡璇㈠埌 - OrgDepartmentDTO orgDepartmentDTO1 = new OrgDepartmentDTO(); - //榛樿灞炴�х粰璧嬪�间笂 - //BeanUtil.convert(departmentVO,orgDepartmentDTO1); - Func.copy(departmentVO,orgDepartmentDTO); - //orgDepartmentDTO1.setName(orgDepartmentDTO.getName()); - //orgDepartmentDTO1.setCode(orgDepartmentDTO.getCode()); - //orgDepartmentDTO1.setDescription(orgDepartmentDTO.getDescription()); - String loginUserId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); - orgDepartmentDTO1.setLastModifier(loginUserId); - DeptInfo deptInfo = changeOrgDeptDTOToDeptInfo(orgDepartmentDTO1); + OrgDepartmentVO dbDepartmentVO = getDeptByDeptOid(orgDepartmentDTO.getOid()); + if(Func.isEmpty(dbDepartmentVO)){ + throw new VciBaseException("淇敼鐨勯儴闂ㄤ笉瀛樺湪锛�"); + } + //閮ㄩ棬鍚嶅拰缂栧彿鍒ら噸 + Map<String, String> conditionMap = new HashMap<>(); + conditionMap.put("plname",QueryOptionConstant.OR + orgDepartmentDTO.getName()); + if(Func.isNotBlank(orgDepartmentDTO.getId())){ + conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId()); + } + List<OrgDepartmentVO> repeatDepartmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap); + repeatDepartmentVOS = repeatDepartmentVOS.stream().filter(item -> { + if((item.getName().equals(orgDepartmentDTO.getName()) || item.getId().equals(orgDepartmentDTO.getId())) && + !item.getOid().equals(orgDepartmentDTO.getOid())){ + return true; + } + return false; + }).collect(Collectors.toList()); + if(Func.isNotEmpty(repeatDepartmentVOS) ){ + throw new VciBaseException("鍚屼竴鐖惰妭鐐逛笅璇ラ儴闂ㄥ悕绉版垨缂栧彿宸茬粡瀛樺湪,璇蜂慨鏀�!"); + } + OrgDepartmentDTO departmentDTO = new OrgDepartmentDTO(); + BeanUtil.convert(dbDepartmentVO,departmentDTO); + departmentDTO.setCode(orgDepartmentDTO.getCode()); + departmentDTO.setId(orgDepartmentDTO.getId()); + departmentDTO.setSpecialties(orgDepartmentDTO.getSpecialties()); + departmentDTO.setDescription(orgDepartmentDTO.getDescription()); + departmentDTO.setName(orgDepartmentDTO.getName()); + String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + orgDepartmentDTO.setLastModifier(loginUserId); + DeptInfo deptInfo = changeOrgDeptDTOToDeptInfo(departmentDTO); boolean updateBoolean = platformClientUtil.getFrameworkService().updateDepartment(deptInfo, new UserEntityInfo(loginUserId, null)); return updateBoolean; } @@ -596,6 +730,176 @@ return stringOrgDepartmentVOMap; } + /** + * 涓嬭浇瀵煎叆閮ㄩ棬鐨別xcel妯℃澘銆� + * @param downloadFileName + * @return + */ + @Override + public String downloadImportTemplate(String downloadFileName) { + //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ悕绉� + downloadFileName = Func.isBlank(downloadFileName) ? "閮ㄩ棬瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):downloadFileName; + // 璁剧疆琛ㄥ崟鍒楀悕 + List<String> columns = new ArrayList<>(Arrays.asList("ID", "鍚嶇О", "缂栧彿", "浠e彿", "涓撲笟", "鐖禝D锛堥儴闂ㄥ敮涓�鏍囪瘑ID锛�", "鎻忚堪")); + //璁剧疆蹇呭~鍒� + ColumnNameisRed.clear(); + ColumnNameisRed.add(0); + ColumnNameisRed.add(1); + //鍐檈xcel + String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + downloadFileName + ".xls"; + try { + new File(excelPath).createNewFile(); + } catch (Throwable e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); + } + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + for (int index = 0; index < columns.size(); index++) { + //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹� + if(ColumnNameisRed.contains(index)){ + WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index)); + excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); + excelDataList.add(excelData); + }else{ + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** + * 瀵煎叆閮ㄩ棬 + * @param file + * @return + * @throws VciBaseException + */ + @Override + public BaseResult importDept(File file) throws VciBaseException { + VciBaseUtil.alertNotNull(file,"excel鏂囦欢"); + if(!file.exists()){ + throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()}); + } + try{ + //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞� + ReadExcelOption excelOption = new ReadExcelOption(); + //褰撳墠鐧诲綍鐨勭敤鎴疯处鍙� + //String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + String loginUserId = "developer"; + UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null); + List<OrgDeptPO> poList = ExcelUtil.readDataObjectFromExcel(file, OrgDeptPO.class,excelOption,(value, po, fieldName)->{}); + //鍘婚櫎閮芥槸绌虹殑鎯呭喌 + if(CollectionUtils.isEmpty(poList)){ + return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); + } + /*閮ㄩ棬瀵煎叆鍑犱釜姣旇緝閲嶈鐨勬儏鏅細 + 1銆佸綋鍓嶅鍏ョ殑鏁版嵁鏄竴涓儴闂ㄦ爲缁撴瀯(瑕佸垽鏂敤鎴锋墜杈撶殑ID鏄惁瀛樺湪閲嶅锛岃緭浜嗗氨瑕佸垽鏂槸鍚﹀湪褰撳墠琛ㄦ牸涓噸澶嶏紝 + 骞朵笖淇濆瓨鏃朵笉鑳戒娇鐢ㄧ敤鎴锋墜杈撶殑ID锛岃鏍规嵁鎵嬭緭ID鍜屽疄闄呭瓨鍌∣ID鍋氬搴旀槧灏勶紝 + 骞朵笖涓嶇牬鍧忚〃鏍间腑閮ㄩ棬鏍戠粨鏋勶紝濡傛灉娌℃墜杈揑D灏卞彧闇�瑕佸叧娉╬arentId杩欎釜灞炴�э紝 + 骞朵笖闇�瑕佹敞鎰忓鏋滄湁鐨処D鏈夛紝鏈夌殑娌℃湁閭e氨闇�瑕佹敞鎰忥紝鏃㈠瓨鍦ㄥ拰绯荤粺涓紝 + 鍏宠仈鐨勯儴闂ㄦ爲锛屽張瀛樺湪鍜屽綋鍓嶈〃鏍间腑鍏宠仈鐨勯儴闂ㄦ爲)銆� + 2銆佸綋鍓嶅鍏ョ殑鏁版嵁鐖秈d鍏宠仈浜嗗凡瀛樺湪鐨勯儴闂╫id(瑕佹煡璇㈢埗id杩欎釜閮ㄩ棬鏄惁瀛樺湪锛�) + 瑙e喅鎬濊矾锛氭渶濂芥槸灏嗚〃鏍间腑鍙兘鏄儴闂ㄦ爲鐨勭粰閬嶅巻鎴愭爲锛岀劧鍚庡啀鍋氭煡閲嶅暐鐨勫鐞� + */ + //2銆佸繀濉垽绌恒�佸垽閲嶏紙鏁版嵁搴撳垽閲嶅拰excel涓垽閲嶏級锛岀粍瑁呮垚淇濆瓨鐢ㄧ殑鏁版嵁瀵硅薄 + List<DeptInfo> deptInfoList = new ArrayList<>(); + //2.1銆佺敤浠ュ瓨鍌╡xcel涓噸澶嶇殑鏁版嵁锛屼笁涓笉鍙噸澶嶇殑瀛楁锛夛紙Name涓嶈兘涓虹┖锛孨ame銆丆ode鍚屼竴鐖堕儴闂ㄤ笅鍞竴锛� + List<String> repeatIdList = new ArrayList<>(); + Map<String,String> repeatNameMap = new HashMap<>(); + Map<String,String> repeatNumMap = new HashMap<>(); + Map<String,String> indexMap = new HashMap<>(); + //2.2銆佸瓨鍌ㄧ敤鎴锋墜杈撶殑oid鍜屽疄闄呭瓨鍌╫id鐨勬槧灏勫叧绯� + Map<String, String> oidMap = new HashMap<>(); + poList.stream().forEach(po->{ + String parentId = Func.isBlank(po.getParentId()) ? "":po.getParentId(); + //琛ㄦ牸鍐呭垽閲� + //閮ㄩ棬鍚嶇О鍒ょ┖ + if(Func.isEmpty(po.getName())){ + throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒epterror,Reason:Name cannot be empty"); + }else if(repeatNameMap.getOrDefault(po.getName(), "").equals(parentId)/*excel涓悓涓�閮ㄩ棬涓婲ame鐩哥瓑*/){ + //鍚屼竴閮ㄩ棬涓嬪悕绉板垽閲� + throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptnameerror,Reason: Names under the same department cannot be duplicated"); + }else if(Func.isNotEmpty(po.getId()) && repeatIdList.equals(po.getId())){ + throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptiderror,Reason: The primary key cannot be duplicated"); + }else if(Func.isNotEmpty(po.getNum()) && repeatNumMap.getOrDefault(po.getNum(),"").equals(parentId)/*excel涓悓涓�閮ㄩ棬涓嬬紪鍙峰瓨鍦� */){ + throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptnumerror,Reason: The number cannot be duplicated"); + }else{ + //2.2銆佹煡璇㈡暟鎹簱涓殑鏁版嵁锛堟煡閲岻D鍜孨UM锛夛紝姣旇緝楹荤儲闇�瑕佹牴鎹甈arentID鏌ヨ锛堟墍鏈夊彧鑳藉崟鏉℃煡璇㈣繘琛屽垽閲嶏級 + //缁勮鏌ラ噸鏉′欢:鍚屼竴閮ㄩ棬涓�(parentId鐩哥瓑)锛宯ame鎴栬�卬um鐩哥瓑 + HashMap<String, String> conditionMap = new HashMap<>(); + conditionMap.put("plname",po.getName()); + conditionMap.put("plnum",QueryOptionConstant.OR + po.getNum()); + String pId = Func.isBlank(po.getParentId()) ? null:po.getParentId(); + List<OrgDepartmentVO> repeatOrgDept = this.getDeptByDeptPOidAndCondition(pId, conditionMap); + //鍙涓嶄负绌哄氨璇存槑褰撳墠琛屾暟鎹湪绯荤粺涓噸澶� + if(Func.isNotEmpty(repeatOrgDept)){ + throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptname or deptnum error,Reason: The name or number already exists in the system"); + } + } + //瀛樺偍鏍¢獙閫氳繃鐨勬暟鎹紝浠ヤ究鍚庣画excel鏌ラ噸 + repeatNameMap.put(po.getName(),Func.isBlank(po.getParentId()) ? "":po.getParentId()); + repeatIdList.add(po.getId()); + repeatNumMap.put(po.getNum(),po.getParentId()); + indexMap.put(po.getName(),po.getRowIndex()); + //鏍¢獙鏁版嵁灏辫缁勮鎴怐TO鏁版嵁瀵硅薄浜� + OrgDepartmentDTO dto = new OrgDepartmentDTO(); + BeanUtil.convert(po,dto); + dto.setOid(po.getId()); + dto.setId(po.getNum()); + dto.setPkFatherDepartment(po.getParentId()); + dto.setCreateTime(new Date()); + dto.setCreator(loginUserId); + dto.setLastModifier(loginUserId); + dto.setStatus((short) 0); + //2.2銆佽繃绋嬩腑澶勭悊涓婚敭杞崲闂鏈�濂芥槸涓�鏉′竴鏉$殑澶勭悊ID鏄惁瀛樺湪杩樻湁ParentID鏄惁瀛樺湪鐨勯棶棰� + //鍏堝垽鏂槸宸插瓨鍦ㄧ殑閮ㄩ棬ID锛岃繕鏄笉瀛樺湪鐨勯儴闂↖D锛屽凡瀛樺湪绯荤粺涓殑ID灏辨槸涓篋ept:寮�澶寸殑 + String pId = dto.getPkFatherDepartment(); + //鏄凡瀛樺湪绯荤粺涓殑閮ㄩ棬id + if(pId.contains("Dept:")){ + //瑙f瀽鍑虹湡瀹炵殑oid + String deParentId = Func.oidDeHash(pId.replace("Dept:", "").trim()); + //瑙f瀽鍑烘潵鐨刣eParentId蹇呴』寰楀湪搴撲腑瀛樺湪 + if(Func.isBlank(deParentId) || Func.isEmpty(this.getDeptByDeptOid(deParentId))){ + throw new VciBaseException("绗��"+ po.getRowIndex() +"銆戣锛宒eptparentiderror,Reason:Parent ID resolution error or does not exist in the system"); + } + //鏇挎崲鎺変复鏃朵娇鐢ㄧ殑閮ㄩ棬鍞竴鏍囪瘑 + dto.setPkOrganizationName(deParentId); + } + //鐢ㄦ埛鎵嬭緭浜嗛儴闂╫id锛屼絾鏄伩鍏峯id涓嶈鑼冮渶瑕侊紝鐢ㄨ鑼僶id杩涜鏇挎崲锛屽鏋滄病杈撳叆淇濆瓨鏃朵細鑷姩鐢熸垚oid + if(Func.isNotBlank(dto.getOid())){ + String pkOid = VciBaseUtil.getPk(); + dto.setOid(pkOid); + //oid鏄犲皠鍏崇郴锛屽悗缁敤鏉ユ洿鏂皃arentId + oidMap.put(dto.getOid(),pkOid); + } + DeptInfo deptInfo = this.changeOrgDeptDTOToDeptInfo(dto); + deptInfoList.add(deptInfo); + }); + //3銆佸鐞唅d鍜宲arentId鐨勬槧灏勫叧绯�:灏嗙敤鎴锋墜杈撶殑鐖禝D杞崲鎴愬疄闄呭瓨鍌ㄧ殑ID + List<DeptInfo> lastDeptInfoList = deptInfoList.stream().map(info -> { + //parentId涓嶄负绌哄苟涓旀病鏈塂ept:鐩稿叧鐨勫瓧绗︿覆,璇存槑鏄敤鎴锋墜杈撶殑ParentId(瀵煎叆鐨勬暟鎹氨鏄竴涓爲缁撴瀯) + if (Func.isNotBlank(info.parentId) || info.parentId.contains("Dept:")) { + //杞崲ParentId涓哄疄闄呰瀛樺偍鐨勯儴闂↖D + info.parentId = oidMap.get(info.parentId); + } + return info; + }).collect(Collectors.toList()); + //4銆佸鏈�缁堝鐞嗗ソ鐨勯儴闂ㄦ暟鎹繚瀛橈紝瀹炵幇鏈�缁堢粺涓�淇濆瓨锛岄伩鍏嶄簡涓�閮ㄥ垎鏁版嵁杩涗簡涓�閮ㄥ垎鏁版嵁鍥犱负鏍¢獙娌¤繃娌¤繘搴撶殑闂 + platformClientUtil.getFrameworkService().batchSaveDepart( + lastDeptInfoList.toArray(new DeptInfo[lastDeptInfoList.size()]), + userEntityInfo + ); + }catch (Exception e){ + if(logger.isErrorEnabled()){ + logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",e.getMessage()); + } + e.printStackTrace(); + return BaseResult.fail(LangBaseUtil.getErrorMsg(e),new String[]{},e); + } + return BaseResult.success("閮ㄩ棬瀵煎叆鎴愬姛锛�"); + } + public Map<String, OrgDepartmentVO> convertToMap(List<OrgDepartmentVO> orgDepartmentVOList) { Map<String, OrgDepartmentVO> map = new HashMap<>(); for (OrgDepartmentVO orgDepartmentVO : orgDepartmentVOList) { diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java index fa9b95d..4374a0a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java @@ -567,7 +567,7 @@ } /** - * 淇濆瓨鐢ㄦ埛瑙掕壊鍏宠仈鍏崇郴 + * 鎴愬憳绠$悊鍒嗛厤瑙掕壊璋冪敤锛屼繚瀛樼敤鎴疯鑹插叧鑱斿叧绯� * @param userOids * @param roleIds * @return @@ -576,7 +576,23 @@ public boolean saveRights(String[] userOids, String[] roleIds) throws PLException { VciBaseUtil.alertNotNull(userOids,"鐢ㄦ埛涓婚敭"); //roleIds鍏佽涓虹┖锛屼负绌烘椂娓呯┖褰撳墠鐢ㄦ埛鐨勬潈闄� - return platformClientUtil.getFrameworkService().saveRights(roleIds,userOids,new UserEntityInfo()); + UserEntityInfo userEntityInfo = new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(),null); + return platformClientUtil.getFrameworkService().saveRights(roleIds,userOids,userEntityInfo); + } + + /** + * 瑙掕壊绠$悊鍒嗛厤鎴愬憳鎺ュ彛璋冪敤 + * @param userOids + * @param roleId + * @return + * @throws PLException + */ + @Override + public boolean saveRight(String[] userOids, String roleId) throws PLException { + VciBaseUtil.alertNotNull(roleId,"瑙掕壊涓婚敭"); + //roleIds鍏佽涓虹┖锛屼负绌烘椂娓呯┖褰撳墠鐢ㄦ埛鐨勬潈闄� + UserEntityInfo userEntityInfo = new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(),null); + return platformClientUtil.getFrameworkService().saveRight(roleId,userOids,userEntityInfo); } /** @@ -632,7 +648,7 @@ smRoleDTO.getName(),"瑙掕壊鍚�"); //鏌ヨ鏁版嵁搴撲腑鐨勶紝鏍规嵁瑙掕壊鍚嶆煡 Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("pluid",smRoleDTO.getOid()); + conditionMap.put("plname",smRoleDTO.getName()); SmRoleVO dbSmRoleVO = getRoleByConditionMap(conditionMap); //鏍规嵁涓婚敭娌℃煡璇㈠埌浜嗙敤鎴� if(Func.isEmpty(dbSmRoleVO) || Func.isBlank(dbSmRoleVO.getOid())){ 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 9930d7f..dbea2f7 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 @@ -30,7 +30,6 @@ import com.vci.starter.web.util.*; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.enumpck.UserTypeEnum; -import com.vci.web.model.WFProcessClassifyDO; import com.vci.web.service.WebBoServiceI; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; @@ -123,7 +122,7 @@ /** * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栭儴闂ㄦ斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇� */ - private Map<String,List<OrgDepartmentVO>> orgDepartmentVOMap; + private Map<String,Map<String,String>> orgDepartmentVOMap; /** * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栬鑹叉斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇� @@ -323,21 +322,19 @@ smUserVO.setPassword(userInfo.pwd); smUserVO.setConfirmPassword(userInfo.pwd); //鐢ㄦ埛鎵�灞為儴闂ㄧ殑鏌ヨ璁剧疆 - List<OrgDepartmentVO> orgDepartmentVOList; + Map<String,String> orgDepartmentVOList; //鏌ョ湅鍏ㄥ眬鍙橀噺涓槸鍚﹀瓨鍦ㄩ儴闂ㄤ俊鎭紝瀛樺湪鐨勬儏鍐垫渶涓昏鏄拡瀵瑰鏉$敤鎴锋煡璇㈢殑鏃跺�欓伩鍏嶉噸澶嶆煡璇㈢殑 if(Func.isNotEmpty(orgDepartmentVOMap)){ - orgDepartmentVOList = orgDepartmentVOMap.get(userInfo.id); + orgDepartmentVOList = Func.isNotEmpty(orgDepartmentVOMap.get(userInfo.id)) ? + orgDepartmentVOMap.get(userInfo.id):new HashMap<>(); }else { - orgDepartmentVOList = orgDeptQueryService.listDeptByUserOid(userInfo.id,null); + Map<String, Map<String, String>> tempDeptMap = orgDeptQueryService.batchMapDeptNameByUserOids(Arrays.asList(userInfo.id), null); + orgDepartmentVOList = Func.isNotEmpty(tempDeptMap.get(userInfo.id)) ? + tempDeptMap.get(userInfo.id):new HashMap<>(); } - smUserVO.setPkDepartment( - Func.isEmpty(orgDepartmentVOList) ? - null:orgDepartmentVOList.stream().map(OrgDepartmentVO::getOid).collect(Collectors.joining(",")) - ); - smUserVO.setPkDepartmentName( - Func.isEmpty(orgDepartmentVOList) ? - null:orgDepartmentVOList.stream().map(OrgDepartmentVO::getName).collect(Collectors.joining(",")) - ); + //閮ㄩ棬oid锛屾甯告儏鍐典笅涓�涓敤鎴峰彧浼氬瓨鍦ㄤ竴涓儴闂ㄤ笅 + smUserVO.setPkDepartment(orgDepartmentVOList.keySet().stream().collect(Collectors.joining(","))); + smUserVO.setPkDepartmentName(orgDepartmentVOList.values().stream().collect(Collectors.joining(","))); //瀵嗙爜绛栫暐鏌ヨ璁剧疆 SmPasswordStrategyVO smPasswordStrategyVO; if(Func.isNotEmpty(smPwdStrategyVOMap)){ @@ -536,7 +533,7 @@ DataGrid<SmUserVO> dataGrid = new DataGrid<>(); if(Func.isNotEmpty(userInfos)){ List<String> idList = Arrays.stream(userInfos).map(item -> item.id).collect(Collectors.toList()); - orgDepartmentVOMap = orgDeptQueryService.batchListDeptByUserOids(idList, null); + orgDepartmentVOMap = orgDeptQueryService.batchMapDeptNameByUserOids(idList, null); smRoleVOMap = smRoleQueryService.batchListRoleByUserOids(idList,null); smPwdStrategyVOMap = smPwdStrategyQueryService.batchSmPwdStrategyByUserOids(idList); dataGrid.setData(userInfoArr2VO(userInfos)); @@ -607,10 +604,27 @@ @Override public List<SmUserVO> countSmUserByDeptOid(String deptOid, Map<String, String> queryMap) throws VciBaseException { //鏄惁鏌ヨ瀛愰儴闂ㄤ笅鍏宠仈鐨勭敤鎴� - List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.listChildrenDeptByParentOid(deptOid, null); + List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.listAllLevelChildrenDeptByParentOid(deptOid, null); List<String> deptOidCollection = orgDepartmentVOList.stream().map(OrgDepartmentVO::getOid).collect(Collectors.toList()); deptOidCollection.add(deptOid);//灏嗗綋鍓嶅眰鐨刼id涔熸斁杩涘幓 - return listUserVOByDeptOid(queryMap,deptOidCollection,false); + List<SmUserVO> smUserVOList = listUserVOByDeptOid(queryMap, deptOidCollection, false); + if(Func.isEmpty(smUserVOList)){ + return new ArrayList<>(); + } + Map<String, List<SmRoleVO>> smRoleVOMap = smRoleQueryService.batchListRoleByUserOids(smUserVOList.stream().map(SmUserVO::getOid).collect(Collectors.toSet()), null); + smUserVOList = smUserVOList.stream().map(vo->{ + List<SmRoleVO> smRoleVOS = smRoleVOMap.get(vo.getOid()); + vo.setPkPerson( + Func.isEmpty(smRoleVOS) ? + null:smRoleVOS.stream().map(SmRoleVO::getOid).collect(Collectors.joining(",")) + ); + vo.setPkPersonName( + Func.isEmpty(smRoleVOS) ? + null:smRoleVOS.stream().map(SmRoleVO::getName).collect(Collectors.joining(",")) + ); + return vo; + }).collect(Collectors.toList()); + return smUserVOList; } /** @@ -672,6 +686,7 @@ queryWrapperForDO.setLinkTableSql(" left join pluserdept up on " + queryWrapperForDO.getTableNick() + ".pluid = up.pluseruid" + " left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapperForDO.getTableNick() + ".pluid = pkUserPassword.pluseruid "); + queryWrapperForDO.setOrderSql("order by " + queryWrapperForDO.getTableNick() + ".pltrueName"); List<SmUserDO> smUserDOList = new ArrayList<>(); //userOidList涓虹┖鏃剁殑涓ょ鎯呭喌 if(Func.isEmpty(userOidList)){ @@ -1198,9 +1213,7 @@ } //鏍规嵁褰撳墠鍒涘缓杩欎釜鐢ㄦ埛鐨勪汉鎵�缁戝畾瀵嗙爜绛栫暐鏉ヨ繘琛屽瘑鐮佹牎楠� try { - //TODO:涓轰簡鏂逛究璋冭瘯锛屾墍浠ヨ繖鍎垮厛娉ㄩ噴鍐欐鍚庨潰璁板緱鏇存敼 String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); - //String userName = "developer"; String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userName, smUserDTO.getPassword(),null); if (!StringUtils.isBlank(error)) { throw new VciBaseException("褰撳墠璁剧疆鐨勫瘑鐮侊紝瀵嗙爜绛栫暐鏍¢獙鏈�氳繃"); @@ -1330,7 +1343,6 @@ ReadExcelOption excelOption = new ReadExcelOption(); //褰撳墠鐧诲綍鐨勭敤鎴疯处鍙� String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); - //String loginUserId = "developer"; UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null); //鏄惁瀵煎叆瀵嗙骇閰嶇疆 boolean exportSecretGrade = Boolean.parseBoolean(ConfigReader.getConfigValue("exportSecretGrade")); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java index c7e9675..a83aa20 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java @@ -1,20 +1,34 @@ package com.vci.frameworkcore.controller; +import com.vci.corba.common.PLException; +import com.vci.corba.common.data.UserEntityInfo; +import com.vci.corba.framework.data.DeptInfo; import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI; +import com.vci.frameworkcore.constant.FrameWorkLangCodeConstant; import com.vci.frameworkcore.model.dto.OrgDepartmentDTO; import com.vci.frameworkcore.pagemodel.OrgDepartmentVO; import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; +import com.vci.starter.web.util.ControllerUtil; +import com.vci.starter.web.util.LangBaseUtil; +import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.util.Func; +import com.vci.web.util.PlatformClientUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.Date; import java.util.List; /** @@ -65,18 +79,18 @@ /** * 淇濆瓨閮ㄩ棬鐢ㄦ埛鍏宠仈淇℃伅锛屽钩鍙拌嚜甯︽煡閲嶅姛鑳� - * @param userOIds 鐢ㄦ埛id + * @param userOids 鐢ㄦ埛id * @param deptId 閮ㄩ棬oid * @return */ @RequestMapping(value = "/saveUsersDepts",method = RequestMethod.POST) - public BaseResult saveUsersDepts(String[] userOIds, String deptId){ + public BaseResult saveUsersDepts(String[] userOids, String deptId){ //涓嶈兘鍚屾椂涓虹┖ - if(Func.isEmpty(userOIds) && Func.isBlank(deptId)){ + if(Func.isEmpty(userOids) && Func.isBlank(deptId)){ return BaseResult.fail("瑙掕壊涓婚敭鍜岄儴闂ㄤ富閿紝鍙傛暟涓嶈兘鍚屾椂涓虹┖!"); } try { - return deptQueryService.saveUsersDept(userOIds,deptId) ? BaseResult.success("閮ㄩ棬鍒嗛厤鎴愬姛锛�"):BaseResult.fail("閮ㄩ棬鍒嗛厤澶辫触锛�"); + return deptQueryService.saveUsersDept(userOids,deptId) ? BaseResult.success("閮ㄩ棬鍒嗛厤鎴愬姛锛�"):BaseResult.fail("閮ㄩ棬鍒嗛厤澶辫触锛�"); }catch (Exception e){ e.printStackTrace(); String exceptionMessage = VciBaseUtil.getExceptionMessage(e); @@ -91,7 +105,6 @@ * @return */ @RequestMapping(value = "/addDept",method = RequestMethod.POST) - @VciUnCheckRight public BaseResult addDept(@RequestBody OrgDepartmentDTO orgDepartmentDTO){ try { return deptQueryService.addDept(orgDepartmentDTO) ? BaseResult.success("閮ㄩ棬娣诲姞鎴愬姛锛�"):BaseResult.fail("閮ㄩ棬娣诲姞澶辫触锛�"); @@ -109,7 +122,6 @@ * @return */ @RequestMapping(value = "/updateDept",method = RequestMethod.PUT) - @VciUnCheckRight public BaseResult updateRole(@RequestBody OrgDepartmentDTO orgDepartmentDTO){ try { return deptQueryService.updateDept(orgDepartmentDTO) ? BaseResult.success("閮ㄩ棬淇敼鎴愬姛锛�"):BaseResult.fail("閮ㄩ棬淇敼澶辫触锛�"); @@ -127,7 +139,6 @@ * @return */ @RequestMapping(value = "/deleteDept",method = RequestMethod.DELETE) - @VciUnCheckRight public BaseResult deleteDept(String[] ids){ try { return deptQueryService.deleteDept(ids) ? BaseResult.success("鍒犻櫎閮ㄩ棬鎴愬姛锛�"):BaseResult.fail("鍒犻櫎閮ㄩ棬澶辫触锛�"); @@ -139,4 +150,50 @@ } } + /** + * 涓嬭浇浜哄憳瀵煎叆妯℃澘 + * @param downloadFileName + * @param response + */ + @RequestMapping(value = "/downloadImportTemplate",method = RequestMethod.GET) + @VciUnCheckRight + public void downloadImportTemplate(String downloadFileName, HttpServletResponse response){ + try { + String excelPath = deptQueryService.downloadImportTemplate(downloadFileName); + ControllerUtil.writeFileToResponse(response,excelPath); + } catch (Exception e) { + String msg = "涓嬭浇閮ㄩ棬瀵煎叆妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + LangBaseUtil.getErrorMsg(e); + try { + e.printStackTrace(); + ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + } + + /** + * 閮ㄩ棬瀵煎叆 + * @param file + * @return + */ + @RequestMapping(value = "/importDept",method = RequestMethod.POST) + @VciUnCheckRight + public BaseResult importUser(MultipartFile file){ + String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); + File file1 = new File(excelFileName); + try { + file.transferTo(new File(excelFileName)); + if (file != null) { + return deptQueryService.importDept(file1); + } else { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + }catch (Throwable e) { + throw new VciBaseException(e.getMessage(),new String[0],e); + }finally { + file1.delete(); + } + } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java index 02d7ab6..fdcb496 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java @@ -195,7 +195,7 @@ } /** - * 鍒嗛厤瑙掕壊锛氫繚瀛樼敤鎴疯鑹插叧鑱斿叧绯伙紝鐢ㄦ埛绠$悊鐨勫垎閰嶈鑹插拰瑙掕壊绠$悊鐨勫垎閰嶆垚鍛樺叡鐢� + * 鎴愬憳绠$悊鍒嗛厤瑙掕壊锛氫繚瀛樼敤鎴疯鑹插叧鑱斿叧绯� * @param userOids * @param roleIds * @return @@ -207,8 +207,26 @@ }catch (Exception e){ e.printStackTrace(); String exceptionMessage = VciBaseUtil.getExceptionMessage(e); - log.error("鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇锛屽叧鑱旂殑瑙掕壊鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); - return BaseResult.fail("鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇锛屽叧鑱旂殑瑙掕壊鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); + log.error("鍒嗛厤瑙掕壊鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); + return BaseResult.fail("鍒嗛厤瑙掕壊鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); + } + } + + /** + * 瑙掕壊绠$悊鍒嗛厤鎴愬憳锛氫繚瀛樼敤鎴疯鑹插叧鑱斿叧绯� + * @param userOids + * @param roleId + * @return + */ + @RequestMapping(value = "/saveRight",method = RequestMethod.POST) + public BaseResult saveRight(String[] userOids, String roleId){ + try { + return roleQueryService.saveRight(userOids,roleId) ? BaseResult.success("鎴愬憳鍒嗛厤鎴愬姛锛�"):BaseResult.fail("鎴愬憳鍒嗛厤澶辫触锛�"); + }catch (Exception e){ + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + log.error("鍒嗛厤鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); + return BaseResult.fail("鍒嗛厤鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + exceptionMessage); } } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/OrgDeptForPlatform1.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/OrgDeptForPlatform1.java index 569307b..1dbdfbf 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/OrgDeptForPlatform1.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/OrgDeptForPlatform1.java @@ -31,6 +31,16 @@ private String plnum; /** + * 閮ㄩ棬浠e彿 + */ + private String plcode; + + /** + * 涓撲笟 + */ + private String plspecialties; + + /** * 鍋滅敤鍚敤鐘舵�� */ private Short plstatus; @@ -48,7 +58,7 @@ /** * 鍒涘缓鏃堕棿 */ - private Date plcreatetime; + private Long plcreatetime; /** * 鍒涘缓浜� @@ -58,7 +68,7 @@ /** * 鏈�鍚庝慨鏀规椂闂� */ - private Date plupdatetime; + private Long plupdatetime; /** * 鏈�鍚庝慨鏀逛汉 @@ -69,6 +79,22 @@ * 涓嶇煡閬撳仛鍟ョ殑 */ private String pllicensors; + + public String getPlspecialties() { + return plspecialties; + } + + public void setPlspecialties(String plspecialties) { + this.plspecialties = plspecialties; + } + + public String getPlcode() { + return plcode; + } + + public void setPlcode(String plcode) { + this.plcode = plcode; + } public String getPluid() { return pluid; @@ -118,11 +144,11 @@ this.pldesc = pldesc == null ? null : pldesc.trim(); } - public Date getPlcreatetime() { + public Long getPlcreatetime() { return plcreatetime; } - public void setPlcreatetime(Date plcreatetime) { + public void setPlcreatetime(Long plcreatetime) { this.plcreatetime = plcreatetime; } @@ -134,11 +160,11 @@ this.plcreateuser = plcreateuser == null ? null : plcreateuser.trim(); } - public Date getPlupdatetime() { + public Long getPlupdatetime() { return plupdatetime; } - public void setPlupdatetime(Date plupdatetime) { + public void setPlupdatetime(Long plupdatetime) { this.plupdatetime = plupdatetime; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/dto/OrgDepartmentDTO.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/dto/OrgDepartmentDTO.java index 7de034e..74b52cf 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/dto/OrgDepartmentDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/dto/OrgDepartmentDTO.java @@ -83,11 +83,11 @@ /** * 涓撲笟 */ - public String specialties; + private String specialties; /** * 鐘舵�� */ - public short status; + private short status; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/po/OrgDeptPO.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/po/OrgDeptPO.java new file mode 100644 index 0000000..5929c19 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/po/OrgDeptPO.java @@ -0,0 +1,72 @@ +package com.vci.frameworkcore.model.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import com.vci.starter.web.pagemodel.BaseModelVO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 閮ㄩ棬鐨勫鍏ュ鍑哄璞� + * @author ludc + * @date 2024/7/5 16:35 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OrgDeptPO extends BaseModelVO { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = -2239512786206928201L; + + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 涓婚敭 + */ + @ExcelColumn(value="ID") + private String id; + + /** + * 閮ㄩ棬鍚嶇О + */ + @ExcelColumn(value="鍚嶇О",nullable = false) + private String name; + + /** + * 缂栧彿 + */ + @ExcelColumn(value="缂栧彿") + private String num; + + /** + * 閮ㄩ棬浠e彿锛屽搴旇〃涓璸lcode瀛楁 + */ + @ExcelColumn(value="浠e彿") + private String code; + + /** + * 涓撲笟 + */ + @ExcelColumn(value="涓撲笟") + private String specialties; + + /** + * 鐖秈d + */ + @ExcelColumn(value="鐖禝D锛堥儴闂ㄥ敮涓�鏍囪瘑ID锛�") + private String parentId; + + /** + * 鎻忚堪 + */ + @ExcelColumn(value="鎻忚堪") + private String desc; + +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/OrgDepartmentVO.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/OrgDepartmentVO.java index 9895d7f..20344e8 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/OrgDepartmentVO.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/OrgDepartmentVO.java @@ -20,9 +20,34 @@ private String id; /** + * 闄ら儴闂ㄤ富閿鐨勫敮涓�鏍囪瘑锛岄暱搴︿负8浣嶏紝鍙�氳繃璇ュ弬鏁板弽鎺ㄥ洖閮ㄩ棬涓婚敭;涓昏鐢ㄤ簬瀵煎叆閮ㄩ棬鏃朵娇鐢� + */ + private String uniqueId; + + /** * 閮ㄩ棬鍚嶇О */ private String name; + + /** + * 閮ㄩ棬浠e彿 + */ + private String code; + + /** + * 涓撲笟 + */ + private String specialties; + + /** + * 鍋滅敤鍚敤鐘舵�� + */ + private Short status; + + /** + * 鍋滅敤鍚敤鐘舵�佹樉绀哄�� + */ + private String statusText; /** * 閮ㄩ棬绾у埆 @@ -73,7 +98,49 @@ * 閮ㄩ棬鑱旂郴鐢佃瘽 */ private String tel; - private int treelevel; + + private int treelevel; + + public String getCode() { + return code; + } + + public String getSpecialties() { + return specialties; + } + + public Short getStatus() { + return status; + } + + public void setCode(String code) { + this.code = code; + } + + public void setSpecialties(String specialties) { + this.specialties = specialties; + } + + public void setStatus(Short status) { + this.status = status; + } + + public void setStatusText(String statusText) { + this.statusText = statusText; + } + + public String getStatusText() { + return statusText; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + @Override public String getId() { return id; diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java index 86007ae..eefb170 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java @@ -40,6 +40,60 @@ public class Func { /** + * 閫氬父鐢ㄤ簬灏嗕富閿畂id杞崲鎴�8浣嶅敮涓�hash鐮佸�� + * @return + */ + public static String oidEnHash(String oid){ + UUID originalUUID = UUID.fromString(oid); + // 浣跨敤Base64缂栫爜灏嗗師濮婾UID杞崲涓鸿緝鐭殑瀛楃涓� + String base64String = Base64.getUrlEncoder().withoutPadding().encodeToString(new byte[] { + (byte)(originalUUID.getMostSignificantBits()>>>56), + (byte)(originalUUID.getMostSignificantBits()>>>48), + (byte)(originalUUID.getMostSignificantBits()>>>40), + (byte)(originalUUID.getMostSignificantBits()>>>32), + (byte)(originalUUID.getMostSignificantBits()>>>24), + (byte)(originalUUID.getMostSignificantBits()>>>16), + (byte)(originalUUID.getMostSignificantBits()>>>8), + (byte)(originalUUID.getMostSignificantBits()), + (byte)(originalUUID.getLeastSignificantBits()>>>56), + (byte)(originalUUID.getLeastSignificantBits()>>>48), + (byte)(originalUUID.getLeastSignificantBits()>>>40), + (byte)(originalUUID.getLeastSignificantBits()>>>32), + (byte)(originalUUID.getLeastSignificantBits()>>>24), + (byte)(originalUUID.getLeastSignificantBits()>>>16), + (byte)(originalUUID.getLeastSignificantBits()>>>8), + (byte)(originalUUID.getLeastSignificantBits())}); + return base64String; + } + + /** + * 閫氬父鐢ㄤ簬灏嗕富閿畂id杞崲鎴愮殑8浣嶅敮涓�hash鐮侊紝鍙嶈浆涓簅id + * @param base64String + * @return + */ + public static String oidDeHash(String base64String){ + // 鍙嶆帹鍥炲師濮嬬殑UUID瀛楃涓� + byte[] bytes = Base64.getUrlDecoder().decode(base64String); + UUID reconstructedUUID = new UUID(((long)(bytes[0] & 0xff) << 56) + | ((long)(bytes[1] & 0xff) << 48) + | ((long)(bytes[2] & 0xff) << 40) + | ((long)(bytes[3] & 0xff) << 32) + | ((long)(bytes[4] & 0xff) << 24) + | ((long)(bytes[5] & 0xff) << 16) + | ((long)(bytes[6] & 0xff) << 8) + | (bytes[7] & 0xff), + ((long)(bytes[8] & 0xff) << 56) + | ((long)(bytes[9] & 0xff) << 48) + | ((long)(bytes[10] & 0xff) << 40) + | ((long)(bytes[11] & 0xff) << 32) + | ((long)(bytes[12] & 0xff) << 24) + | ((long)(bytes[13] & 0xff) << 16) + | ((long)(bytes[14] & 0xff) << 8) + | (bytes[15] & 0xff)); + return reconstructedUUID.toString().toUpperCase(Locale.ROOT); + } + + /** * 鏂█锛屽繀椤讳笉鑳戒负 null * <blockquote><pre> * public Foo(Bar bar) { -- Gitblit v1.9.3