From 9503c595d3508c80cbbacf6e69dca459771d250e Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期三, 15 一月 2025 11:01:54 +0800 Subject: [PATCH] 头像上传获取等接口上传 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 130 ++++++++---------- Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java | 9 + Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java | 150 ++++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java | 12 + Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java | 33 ++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLIconDTO.java | 19 ++ Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/PlatformClientUtil.java | 9 + Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLIconVO.java | 17 ++ 8 files changed, 303 insertions(+), 76 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLIconDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLIconDTO.java index 37fab25..800b0c1 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLIconDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/PLIconDTO.java @@ -2,6 +2,8 @@ import lombok.Data; +import java.util.Date; + /** * @Description 鍥炬爣浼犺緭瀵硅薄 * @Author dangsn @@ -38,4 +40,21 @@ * 鍥炬爣鍒嗙粍 */ private String groups; + + /** + * 鍒涘缓鏃堕棿 + */ + private long plCreateTime ; + /** + * 鍒涘缓浜� + */ + private String plCreateUser; + /** + * 淇敼鏃堕棿 + */ + private long plModifyTime ; + /** + * 淇敼浜� + */ + private String plModifyUser; } diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLIconVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLIconVO.java index fb7352e..8320065 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLIconVO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLIconVO.java @@ -43,4 +43,21 @@ * 鍥炬爣鎵�灞炲簱 */ private String lable; + + /** + * 鍒涘缓鏃堕棿 + */ + private long plCreateTime ; + /** + * 鍒涘缓浜� + */ + private String plCreateUser; + /** + * 淇敼鏃堕棿 + */ + private long plModifyTime ; + /** + * 淇敼浜� + */ + private String plModifyUser; } diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java index ed5bbc0..03226c4 100644 --- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java +++ b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java @@ -290,6 +290,39 @@ } /** + * 淇敼鐢ㄦ埛澶村儚 + * @param file 鏂囦欢 + * @return + */ + @RequestMapping(value = "/updateUserPhoto",method = RequestMethod.POST) + public BaseResult updateUserPhoto(MultipartFile file){ + try { + return userQueryService.updateUserPhoto(file) ? BaseResult.success("鐢ㄦ埛澶村儚淇敼鎴愬姛锛�"):BaseResult.fail("鐢ㄦ埛澶村儚淇敼澶辫触锛�"); + }catch (Exception e){ + e.printStackTrace(); + String exceptionMessage = "淇敼鐢ㄦ埛澶村儚鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + + /** + * 鑾峰彇鐢ㄦ埛澶村儚 + * @param response + * @return + */ + @RequestMapping(value = "/getUserPhoto",method = RequestMethod.GET) + public void getUserPhoto(HttpServletResponse response){ + try { + ControllerUtil.writeFileToResponse(response,userQueryService.getUserPhoto()); + } catch (Exception e) { + throw new VciBaseException(e.getMessage(),new String[0],e); + } + } + + + /** * 鍒犻櫎鐢ㄦ埛 * @param ids * @return diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java index 55e921c..e08fa05 100644 --- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java @@ -5,6 +5,7 @@ import com.vci.pagemodel.SmUserVO; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; +import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.util.Collection; @@ -283,4 +284,12 @@ * @return */ String expUser() throws PLException; + /** + * 淇敼鐢ㄦ埛澶村儚 + * @param file 鏂囦欢 + * @return + */ + boolean updateUserPhoto(MultipartFile file) throws PLException; + + String getUserPhoto() throws PLException; } diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java index 9c24c4f..7b8ea7e 100644 --- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java @@ -2,21 +2,27 @@ import com.vci.common.util.ThreeDES; import com.vci.common.utility.ObjectUtility; +import com.vci.constant.FrameWorkLangCodeConstant; +import com.vci.constant.WebLangCodeConstant; import com.vci.corba.common.PLException; import com.vci.corba.common.data.UserEntityInfo; import com.vci.corba.framework.data.*; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.etm.EnumItem; import com.vci.corba.omd.etm.EnumType; +import com.vci.corba.volume.VolumeServicePrx; import com.vci.dto.SmUserDTO; +import com.vci.dto.VciFileObjectDTO; import com.vci.enumpck.UI.OrgTypeEnum; +import com.vci.enumpck.UI.VciFileTransProtocolEnum; import com.vci.enumpck.UserTypeEnum; +import com.vci.lcstatuspck.FileLCStatus; import com.vci.model.SmUserDO; +import com.vci.model.VciFileDocClassifyDO; +import com.vci.model.VciFileObjectDO; +import com.vci.model.VciFileVolumeDO; import com.vci.omd.utils.ObjectTool; -import com.vci.pagemodel.OrgDepartmentVO; -import com.vci.pagemodel.SmPasswordStrategyVO; -import com.vci.pagemodel.SmRoleVO; -import com.vci.pagemodel.SmUserVO; +import com.vci.pagemodel.*; import com.vci.po.SmUserPO; import com.vci.properties.OsConfig; import com.vci.starter.poi.bo.ReadExcelOption; @@ -24,16 +30,21 @@ 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.service.RevisionModelUtil; import com.vci.starter.web.enumpck.BooleanEnum; +import com.vci.starter.web.enumpck.DataSecretEnum; 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.*; import com.vci.starter.web.util.Lcm.Func; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; +import com.vci.web.dao.VciFileObjectDaoI; +import com.vci.web.properties.WebProperties; import com.vci.web.service.*; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.util.HSSFColor; import org.slf4j.Logger; @@ -42,10 +53,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; -import java.io.File; +import javax.annotation.Resource; +import java.io.*; import java.util.*; import java.util.stream.Collectors; + +import static com.vci.constant.FrameWorkLangCodeConstant.UPLOAD_FAIL; /** * 鐢ㄦ埛鐨勬煡璇㈢浉鍏崇殑鏈嶅姟锛屽彲浠ュ吋瀹硅�佸钩鍙板拰鑰佺殑pdm @@ -86,6 +101,24 @@ */ @Autowired private WebPwdStrategyQueryServiceI smPwdStrategyQueryService; + + /** + * 鏂囦欢鐨勫嵎鏈嶅姟 + */ + @Autowired + private VciFileVolumeServiceI vciFileVolumeServiceI; + + /** + * 鐗堟湰鍜屽璞℃搷浣滅被 + */ + @Autowired(required = false) + private RevisionModelUtil revisionModelUtil; + + /** + * 閰嶇疆瀵硅薄 + */ + @Autowired + private WebProperties webProperties; /** * 浣跨敤瑙掕壊鐨勫睘鎬ф煡璇㈢敤鎴锋椂 @@ -141,6 +174,18 @@ * 鏃ュ織 */ private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鏂囦欢涓婁紶涓氬姟灞� + */ + @Autowired + private VciFileUploadServiceI vciFileUploadServiceI; + + /** + * 鏂囦欢淇℃伅鏁版嵁灞� + */ + @Resource + private VciFileObjectDaoI vciFileObjectMapper; /** * 骞冲彴閰嶇疆 @@ -390,6 +435,7 @@ smUserVO.setLastModifier(userInfo.updateUser); smUserVO.setLastLoginTime(VciDateUtil.long2Date(userInfo.updateTime)); smUserVO.setLastModifyPasswordTime(VciDateUtil.long2Date(userInfo.pwdUpdateTime)); + smUserVO.setPhoto(userInfo.photo); return smUserVO; } @@ -1457,6 +1503,7 @@ userInfo.grantor = user.getGrantor() == null ? "" : user.getGrantor(); userInfo.secretGrade = user.getSecretGrade() == null ? 2 : Integer.valueOf(user.getSecretGrade()); userInfo.isDeptLeader = user.getIsDeptLeader() == null ? "0" : user.getIsDeptLeader(); + userInfo.photo = user.getPhoto() == null ? "" : user.getPhoto(); return userInfo; } @@ -1776,6 +1823,99 @@ ExcelUtil.writeDataToFile(excelPath, excelOption); return excelPath; } + /** + * 淇敼鐢ㄦ埛澶村儚 + * @param file 鏂囦欢 + * @return + */ + @Override + public boolean updateUserPhoto(MultipartFile file) throws PLException { + //鑾峰彇鏂囦欢浠撲綅缃� + VciFileVolumeDO vciFileVolumeDO = vciFileVolumeServiceI.getUploadVolume(); + String volumeName = vciFileVolumeDO.getName(); + VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); + if(volumnCorbaService == null){ + throw new VciBaseException("娌℃湁鑾峰彇鍒板嵎鏈嶅姟"); + } + InputStream in = null; + String path = vciFileVolumeDO.getId() + ":/userphoto/" + WebUtil.getSessionInfo().getUserOid() + "." + + FilenameUtils.getExtension(file.getOriginalFilename()); + UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(WebUtil.getSessionInfo().getUserOid()); + if(StringUtils.isNotBlank(userInfo.photo)){ + volumnCorbaService.deleteFile(userInfo.photo); + } + try{ + long currentTime = volumnCorbaService.getCurrrentTimeMillions(); + in = file.getInputStream(); + long fileSize = file.getSize(); + int blockSize = webProperties.getBlockLength()*1024; + byte[] buffer = new byte[blockSize]; + long temp =0L; + for(temp = 0L; temp < fileSize - (long)blockSize; temp += (long)blockSize) { + in.read(buffer, 0, blockSize); + volumnCorbaService.receiveFile(path, buffer, temp, currentTime, fileSize); + } + int remainSize = (int)(fileSize - temp); + buffer = new byte[remainSize]; + in.read(buffer, 0, remainSize); + volumnCorbaService.receiveFile(path, buffer, temp, currentTime, fileSize); + }catch(IOException e){ + throw new VciBaseException("璇诲彇鏂囦欢[" + file.getName() + "]鍑虹幇浜嗛敊璇紝" + e.getMessage() ,new String[0],e); + }catch(Exception e){ + throw new VciBaseException("澶勭悊涓婁紶鏂囦欢[" + file.getName() + "]鍑虹幇浜嗛敊璇紝" + e.getMessage() ,new String[0],e); + }finally { + if(in!=null){ + try { + in.close(); + } catch (IOException e) { + } + } + } + userInfo.photo = path; + boolean b = platformClientUtil.getFrameworkService().updateUser(userInfo, new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)); + if(!b){ + return false; + } + return true; + } + + @Override + public String getUserPhoto() throws PLException { + //鑾峰彇鏂囦欢浠撲綅缃� + VciFileVolumeDO vciFileVolumeDO = vciFileVolumeServiceI.getUploadVolume(); + String volumeName = vciFileVolumeDO.getName(); + VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); + if(volumnCorbaService == null){ + throw new VciBaseException("娌℃湁鑾峰彇鍒板嵎鏈嶅姟"); + } + UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(WebUtil.getSessionInfo().getUserOid()); + String serverPath = userInfo.photo; + String tempFilePath = LocalFileUtil.getDefaultTempFolder() + File.separator+serverPath.substring(serverPath.lastIndexOf("/") + 1); + try { + FileOutputStream destFileOs = new FileOutputStream(tempFilePath); + long blockSize = webProperties.getBlockLength()*1024; + if(blockSize> Integer.MAX_VALUE){ + blockSize = Integer.MAX_VALUE; + } + long fileSize = volumnCorbaService.getFileSize(serverPath); + long temp = 0; + while (fileSize - temp > blockSize) { + destFileOs.write(volumnCorbaService.sendFile(serverPath, temp)); + temp += blockSize; + } + destFileOs.write(volumnCorbaService.sendFile(serverPath, temp)); + destFileOs.flush(); + destFileOs.close(); + } catch (FileNotFoundException e) { + throw new VciBaseException("瑕佸啓鍏ョ殑鏂囦欢娌℃湁鎵惧埌",new String[]{tempFilePath},e); + } catch (IOException e) { + throw new VciBaseException("鍐欏叆鏂囦欢鍑洪敊" + e.getMessage(),new String[]{tempFilePath},e); + } catch (Exception e){ + throw new VciBaseException("鍗锋湇鍔′紶杈撴枃浠舵椂鍑虹幇浜嗛敊璇�" + e.getMessage(),new String[0],e); + } + return tempFilePath; + } + //鏍规嵁瀛愰儴闂ㄦ煡璇㈡墍灞炵殑鐖剁被閮ㄩ棬锛屽苟鎷兼帴鎴愬瓧绗︿覆褰㈠紡锛岃繑鍥� public String getDeptObjectAllByDeptId(DeptInfo obj) throws PLException { String fetchDepName = ""; diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/PlatformClientUtil.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/PlatformClientUtil.java index a2e9a69..a699cb6 100644 --- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/PlatformClientUtil.java +++ b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/PlatformClientUtil.java @@ -12,6 +12,7 @@ import com.vci.corba.omd.ltm.LinkTypeServicePrx; import com.vci.corba.omd.qtm.QTDServicePrx; import com.vci.corba.omd.stm.StatePoolServicePrx; +import com.vci.corba.omd.tim.TypeIndexServicePrx; import com.vci.corba.omd.vrm.VersionRuleServicePrx; import com.vci.corba.pllog.LogServicePrx; import com.vci.corba.portal.PortalServicePrx; @@ -115,6 +116,14 @@ } /** + * 鑾峰彇绫诲瀷绱㈠紩绠$悊鏈嶅姟 + * @return 鏈嶅姟鐨勫璞� + */ + public TypeIndexServicePrx getTypeIndexService() throws PLException { + return WebServiceProvider.getOMDService().getTypeIndexService(); + } + + /** * 鑾峰彇鐢熷懡鍛ㄦ湡鐨勬湇鍔� * @return 鐢熷懡鍛ㄦ湡鐨勬湇鍔″璞� */ diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java index a2c6224..fcba915 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java @@ -19,6 +19,7 @@ import com.vci.corba.omd.lcm.LifeCycle; import com.vci.corba.omd.ltm.LinkType; import com.vci.corba.omd.stm.StatePool; +import com.vci.corba.omd.tim.TypeIndexDef; import com.vci.corba.omd.vrm.VersionRule; import com.vci.dto.OsBtmTypeDTO; import com.vci.model.IndexObject; @@ -1285,29 +1286,18 @@ if (Func.isEmpty(conditionMap)) { return new ArrayList<>(); } - List<String> indexNameList = new ArrayList<String>(); - QueryTemplate qtl = new QueryTemplate(); - List<String> list = new ArrayList<String>(); - list.add("*"); - qtl.setBtmType("indexobject"); - qtl.setClauseList(list); - qtl.setId("p"); - qtl.setType("btm"); - qtl.setRightFlag(false); - Condition condition = OQTool.getCondition(conditionMap); - qtl.setCondition(condition); - //HashMap<String, String> indexmap = new HashMap<String, String>(); - BusinessObject findBTMObjects[] = platformClientUtil.getQueryService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML()); List<IndexObject> indexObjects = new ArrayList<>(); - for (int i = 0; i < findBTMObjects.length; i++) { - BusinessObject findBTMObject = findBTMObjects[i]; + TypeIndexDef[] typenames = ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(conditionMap.get("typename")); + + for (int i = 0; i < typenames.length; i++) { + TypeIndexDef typename = typenames[i]; IndexObject indexObject = new IndexObject(); - indexObject.setOid(findBTMObject.oid); - indexObject.setDescription(findBTMObject.description); - indexObject.setCreateTime(Func.format(new Date(findBTMObject.createTime), DateUtil.PATTERN_DATE)); - indexObject.setIndexName(ObjectTool.getBOAttributeValue(findBTMObject, "indexname")); - indexObject.setTypeName(ObjectTool.getBOAttributeValue(findBTMObject, "typename")); - indexObject.setAttrNames(ObjectTool.getBOAttributeValue(findBTMObject, "attrname")); + indexObject.setOid(typename.oid); + indexObject.setDescription(typename.description); + indexObject.setCreateTime(Func.format(new Date(typename.createTime), DateUtil.PATTERN_DATE)); + indexObject.setIndexName(typename.name); + indexObject.setTypeName(typename.typeName); + indexObject.setAttrNames(typename.attributes); indexObjects.add(indexObject); } return indexObjects; @@ -1323,11 +1313,8 @@ @Override public boolean delIndex(String btmName, String indexName) throws PLException { VciBaseUtil.alertNotNull(btmName, "涓氬姟绫诲瀷鍚�", indexName, "绱㈠紩鍚�"); - Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("typename", btmName); - conditionMap.put("indexname", indexName); - List<IndexObject> bo2 = getIndexByCondition(conditionMap); - if (bo2 != null && bo2.size() > 0) { + TypeIndexDef[] typeIndexDef= ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(btmName); + if( typeIndexDef != null && typeIndexDef.length > 0 ){ String[] indexAttr = {indexName}; boolean alterFlag = platformClientUtil.getBtmService().dropIndex(btmName, indexAttr); @@ -1335,10 +1322,12 @@ if (!alterFlag) { return false; } - for (int i = 0; i < bo2.size(); i++) { - String oid = bo2.get(i).getOid(); - BusinessObject bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject"); - platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1); + for (int i = 0; i < typeIndexDef.length; i++) { + if(!typeIndexDef[i].name.equals(indexName)) { + continue; + } + String oid = typeIndexDef[i].oid; + ClientServiceProvider.getOMDService().getTypeIndexService().delIndexDef(oid); } } return true; @@ -1356,49 +1345,50 @@ String btmName = indexObjectList.get(0).getTypeName(); String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining(",")); String[] oldindexAttr = {indexNames}; - BusinessObject bo; - List<BusinessObject> boList = new ArrayList<>(); - //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣� - Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("typename", btmName); - //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n - conditionMap.put("indexname", indexNames); - List<IndexObject> indexObjects = getIndexByCondition(conditionMap); - if (indexObjects != null && indexObjects.size() > 0) { - //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎 - boolean b = platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr); - if (b) { - for (int i = 0; i < indexObjects.size(); i++) { - String oid = (String) indexObjects.get(i).getOid(); - bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject"); - platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1); - } - } - } +// BusinessObject bo; +// List<BusinessObject> boList = new ArrayList<>(); +// //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣� +// Map<String, String> conditionMap = new HashMap<>(); +// conditionMap.put("typename", btmName); +// //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n +// conditionMap.put("indexname", indexNames); + TypeIndexDef[] typeIndexDefs = platformClientUtil.getTypeIndexService().getBTIndexDefs(btmName); - for (int i = 0; i < indexObjectList.size(); i++) { - IndexObject indexObject = indexObjectList.get(i); - //bo = platformClientUtil.getBOFService().initBusinessObject("indexobject"); - bo = boService.createCBOByBtmName("indexobject"); - List<AttributeValue> attributeValues = new ArrayList<>(); - attributeValues.add(new AttributeValue("typename", btmName)); - attributeValues.add(new AttributeValue("indexname", indexObject.getIndexName())); - attributeValues.add(new AttributeValue("attrname", indexObject.getAttrNames())); - bo.newAttrValList = attributeValues.toArray(new AttributeValue[attributeValues.size()]); - bo.description = indexObject.getDescription(); - String[] indexAttr = {indexObject.getIndexName(), indexObject.getAttrNames()}; - //缁欐寚瀹氫笟鍔$被鍨嬬殑鎸囧畾灞炴�у垱寤虹储寮� - boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr); - //绱㈠紩鍒涘缓鎴愬姛涔嬪悗锛岄渶瑕佸瓨鍌ㄦ垚鍔熺储寮曞埌绱㈠紩琛ㄤ腑 - if (!alterFlag) { - return false; + if(typeIndexDefs!=null && typeIndexDefs.length>0){ + boolean hasIndex = false; + for(int i = 0; i < typeIndexDefs.length; i ++){ + if(!typeIndexDefs[i].name.equals(indexNames)) { + continue; + } + String oid = typeIndexDefs[i].oid; + platformClientUtil.getTypeIndexService().delIndexDef(oid); + hasIndex = true; } - boList.add(bo); - //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑 - //platformClientUtil.getBOFactoryService().createBusinessObject(bo,false,false); + //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎 + if(hasIndex) { + platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr); + } } - //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑 - platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]), false, false); + StringBuilder sb = new StringBuilder(); + List<TypeIndexDef> saveDefs = new ArrayList<>(); + for(int i = 0; i < indexObjectList.size(); i ++){ + TypeIndexDef saveDef = new TypeIndexDef(); + saveDef.typeName = indexObjectList.get(i).getTypeName(); + saveDef.name = indexObjectList.get(i).getIndexName(); + saveDef.description = indexObjectList.get(i).getDescription(); + saveDef.attributes = indexObjectList.get(i).getAttrNames(); + sb.append(indexObjectList.get(i).getAttrNames()); + if(i<indexObjectList.size()-1){ + sb.append(","); + } + saveDefs.add(saveDef); + } + String[] indexAttr = {indexObjectList.get(0).getIndexName(),sb.toString()}; + boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr); + if(!alterFlag) { + return false; + } + ClientServiceProvider.getOMDService().getTypeIndexService().saveIndexDefs(saveDefs.toArray(new TypeIndexDef[saveDefs.size()])); return true; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java index 75ca637..53b7ac3 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebIconServiceImpl.java @@ -81,6 +81,7 @@ icon.content = iconContent; icon.type = type; icon.groups = groups; + icon.plModifyUser = WebUtil.getCurrentUserId(); updateList.add(icon); }else{ PLIcon icon = new PLIcon(); @@ -89,6 +90,7 @@ icon.content = iconContent; icon.type = type; icon.groups = groups; + icon.plCreateUser = WebUtil.getCurrentUserId(); addList.add(icon); } } @@ -121,7 +123,8 @@ plIcon.content = iconContent; plIcon.type = iconDTO.getType(); plIcon.groups = iconDTO.getGroups(); - + plIcon.plCreateUser = WebUtil.getCurrentUserId(); + plIcon.plModifyUser = WebUtil.getCurrentUserId(); try { PortalServicePrx portalServicePrx = platformClientUtil.getPortalService(); portalServicePrx.savePLIcon(plIcon); @@ -154,6 +157,9 @@ plIcon.content = iconContent; plIcon.type = iconDTO.getType(); plIcon.groups = iconDTO.getGroups(); + plIcon.plCreateUser = iconDTO.getPlCreateUser(); + plIcon.plCreateTime = iconDTO.getPlCreateTime(); + plIcon.plModifyUser = WebUtil.getCurrentUserId(); portalServicePrx.updatePLIcon(plIcon); } catch (Exception e) { throw new RuntimeException(e); @@ -244,6 +250,10 @@ vo.setContent(icon.content); vo.setType(icon.type); vo.setGroups(icon.groups); + vo.setPlCreateTime(icon.plCreateTime); + vo.setPlCreateUser(icon.plCreateUser); + vo.setPlModifyTime(icon.plModifyTime); + vo.setPlModifyUser(icon.plModifyUser); String[] nameArr = icon.name.split(":"); if(nameArr.length > 1){ vo.setLable(nameArr[0]); -- Gitblit v1.9.3