| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.omd.etm.EnumType; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | | import com.vci.starter.poi.bo.WriteExcelOption; |
| | | import com.vci.starter.poi.util.ExcelUtil; |
| | |
| | | import plm.corba.attribpool.AttribItem; |
| | | import plm.corba.btm.BTMServiceOperations; |
| | | import plm.corba.btm.BtmItem; |
| | | import com.vci.corba.omd.etm.EnumChild; |
| | | import com.vci.corba.omd.etm.EnumItem; |
| | | import plm.corba.lifecycle.Bound; |
| | | import plm.corba.lifecycle.LifeCyle; |
| | |
| | | */ |
| | | @Autowired |
| | | private OsDDLExportWordFieldProperties wordFieldProperties; |
| | | |
| | | |
| | | /** |
| | | * 导入业务类型和链接类型,包含属性,枚举,状态,生命周期,版本规则等全套内容 |
| | |
| | | private void importEnums(Collection<OsEnumDTO> enumDTOList) throws VciBaseException{ |
| | | Set<String> existEnumIdList = enumService.selectAllEnumMap().keySet(); |
| | | Map<String, OsEnumVO> allEnumMap = enumService.selectAllEnumMap(); |
| | | List<EnumItem> unExistEnumList = new ArrayList<EnumItem>(); |
| | | List<EnumItem> editEnumList = new ArrayList<EnumItem>(); |
| | | List<EnumType> unExistEnumList = new ArrayList<EnumType>(); |
| | | List<EnumType> editEnumList = new ArrayList<EnumType>(); |
| | | |
| | | String userId = WebUtil.getCurrentUserId(); |
| | | String now = VciDateUtil.getNowString(VciDateUtil.DateTimeFormat); |
| | |
| | | for(OsEnumDTO enumDTO : enumDTOList){ |
| | | String enumId = enumDTO.getId().toLowerCase().trim(); |
| | | if(!existEnumIdList.contains(enumId)){ |
| | | EnumItem enumItem = new EnumItem(); |
| | | EnumType enumItem = new EnumType(); |
| | | enumItem.oid = ""; |
| | | enumItem.ts = now; |
| | | enumItem.creator = userId; |
| | |
| | | enumItem.type = "int".equalsIgnoreCase(enumDTO.getEnumValueDataType())?"Integer":"String"; |
| | | enumItem.length = enumDTO.getLength(); |
| | | |
| | | List<EnumChild> childList = new ArrayList<EnumChild>(); |
| | | List<EnumItem> childList = new ArrayList<EnumItem>(); |
| | | Map<String, String> itemMaps = enumDTO.getItemMaps(); |
| | | if(CollectionUtils.isEmpty(itemMaps)){ |
| | | throw new VciBaseException("枚举{0}没有选项",new String[]{enumItem.name}); |
| | | } |
| | | for(String key : itemMaps.keySet()){ |
| | | String value = itemMaps.get(key); |
| | | EnumChild enumChild = new EnumChild(); |
| | | EnumItem enumChild = new EnumItem(); |
| | | enumChild.name = value; |
| | | enumChild.value = key; |
| | | enumChild.description = ""; |
| | | childList.add(enumChild); |
| | | } |
| | | enumItem.children = childList.toArray(new EnumChild[0]); |
| | | enumItem.items = childList.toArray(new EnumItem[0]); |
| | | unExistEnumList.add(enumItem); |
| | | }else{ |
| | | //修改内容 |
| | | EnumItem enumItem = new EnumItem(); |
| | | EnumType enumItem = new EnumType(); |
| | | OsEnumVO enumVO = allEnumMap.get(enumId); |
| | | enumItem.oid = enumVO.getOid(); |
| | | // enumItem.createTime = VciDateUtil.date2Str(enumVO.getCreateTime(),VciDateUtil.DateTimeFormat); |
| | |
| | | enumItem.type = "int".equalsIgnoreCase(enumDTO.getEnumValueDataType())?"Integer":"String"; |
| | | enumItem.length = enumDTO.getLength(); |
| | | |
| | | List<EnumChild> childList = new ArrayList<EnumChild>(); |
| | | List<EnumItem> childList = new ArrayList<EnumItem>(); |
| | | Map<String, String> itemMaps = enumDTO.getItemMaps(); |
| | | if(CollectionUtils.isEmpty(itemMaps)){ |
| | | throw new VciBaseException("枚举{0}没有选项",new String[]{enumItem.name}); |
| | | } |
| | | for(String key : itemMaps.keySet()){ |
| | | String value = itemMaps.get(key); |
| | | EnumChild enumChild = new EnumChild(); |
| | | EnumItem enumChild = new EnumItem(); |
| | | enumChild.name = value; |
| | | enumChild.value = key; |
| | | enumChild.description = ""; |
| | | childList.add(enumChild); |
| | | } |
| | | enumItem.children = childList.toArray(new EnumChild[0]); |
| | | enumItem.items = childList.toArray(new EnumItem[0]); |
| | | editEnumList.add(enumItem); |
| | | } |
| | | } |