| | |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.feign.IWebSecretClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.vo.RevisionRuleVO; |
| | | import com.vci.ubcs.starter.bo.WriteExcelData; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.poi.bo.ReadExcelOption; |
| | |
| | | import org.apache.poi.ss.usermodel.Font; |
| | | import org.apache.poi.ss.usermodel.RichTextString; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.aspectj.apache.bcel.classfile.Code; |
| | | import org.springblade.core.redis.cache.BladeRedis; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | //2.夿å¿
è¾é¡¹ããéè¦å
¨é¨ç屿§ï¼å¦ææ¯å¿
è¾ï¼ä½æ¯è¡¨åéé¢ä¸æ¾ç¤ºçï¼åªè½æ¯å类注å
¥æè
ç»åè§å |
| | | batchCheckRequiredAttrOnOrder(templateVO,allCboList,errorMap); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, allCboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, allCboList,false,errorMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ |
| | |
| | | batchSwitchComponentAttrOnOrder(attrVOS, cboList); |
| | | |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,false,errorMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { |
| | |
| | | //2.夿å¿
è¾é¡¹ããéè¦å
¨é¨ç屿§ï¼å¦ææ¯å¿
è¾ï¼ä½æ¯è¡¨åéé¢ä¸æ¾ç¤ºçï¼åªè½æ¯å类注å
¥æè
ç»åè§å |
| | | batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO,cboList,false,errorMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ |
| | |
| | | //æåå¼ç»åè§å |
| | | batchSwitchComponentAttrOnOrder(attrVOS,cboList); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, codeClassifyTemplateVO, cboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, codeClassifyTemplateVO, cboList,false,errorMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){ |
| | |
| | | //æåå¼ç»åè§å |
| | | batchSwitchComponentAttrOnOrder(attrVOS,cboList); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorKeyMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,false,errorKeyMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | |
| | |
| | | * @param cboList æ¹éçæ°æ® |
| | | */ |
| | | private CodeImportResultVO batchCheckKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO, |
| | | List<ClientBusinessObject> cboList,Map<String,String> errorMap) { |
| | | List<ClientBusinessObject> cboList,boolean isEdit,Map<String,String> errorMap) { |
| | | //ä¸MdmEngineServiceImpléçcheckKeyAttrOnOrderç¸ä¼¼ |
| | | //å
è·åå
³é®å±æ§çè§åï¼ä¹å©ç¨ç»§æ¿çæ¹å¼ |
| | | CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); |
| | |
| | | if(Func.isNotBlank(isParticipateCheckOids)){ |
| | | conditionMap.put("t.codeclsfid",QueryOptionConstant.NOTIN+isParticipateCheckOids); |
| | | } |
| | | if(isEdit){//å¦ææ¯æ´æ¹åéæé¤ç³»ç»æ¬èº« |
| | | conditionMap.put("t.id",QueryOptionConstant.NOTEQUAL+cbo.getId()); |
| | | } |
| | | conditionMap.put("t.lastr", "1"); |
| | | conditionMap.put("t.lastv", "1"); |
| | | |
| | | CodeTemplateAttrSqlBO sqlBO = engineService.getSqlByTemplateVO(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, null); |
| | | List<String> repeatData = commonsMapper.selectList(sqlBO.getSqlId()); |
| | | if(!repeatData.isEmpty()){ |
| | |
| | | List<BaseModel> newCboList = new ArrayList<>(); |
| | | newDataList.stream().forEach(stringStringMap -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(stringStringMap,baseModel,user); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(stringStringMap,baseModel,false); |
| | | baseModel.setData(stringStringMap); |
| | | newCboList.add(baseModel); |
| | | }); |
| | |
| | | List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>(); |
| | | oldDataMap.stream().forEach(dataMap->{ |
| | | ClientBusinessObject clientBusinessObject=new ClientBusinessObject(); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject,true); |
| | | for (String key:dataMap.keySet()){ |
| | | Object value= dataMap.getOrDefault(key,""); |
| | | clientBusinessObject.setAttributeValue(key.toLowerCase(Locale.ROOT),value==null?"":value.toString()); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportGroupCodeExcel(String codeClassifyOid) throws ServiceException { |
| | | public String exportGroupCodeExcel(String codeClassifyOid) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"主é¢åºåç±»ç主é®"); |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); |
| | | CodeClassifyVO codeClassifyVO= classifyFullInfo.getCurrentClassifyVO(); |
| | |
| | | ExecGroupCodePortDataDTO execGroupCodePortDataDTO=new ExecGroupCodePortDataDTO(); |
| | | createExportGroupCodeMapConfig(templateVO,execGroupCodePortDataDTO);//ç»ç»æ°æ® |
| | | if(!CollectionUtils.isEmpty(execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS())){ |
| | | throw new ServiceException("éå¢å±æ§æ å°æªé
ç½®"); |
| | | throw new VciBaseException("éå¢å±æ§æ å°æªé
ç½®"); |
| | | } |
| | | fieldList=execGroupCodePortDataDTO.getFieldList(); |
| | | List<Map<String,String>>dataList=new ArrayList<>(); |
| | |
| | | List<WriteExcelData> excelDataList = new ArrayList<>(); |
| | | Workbook workbook = new HSSFWorkbook(); |
| | | List<CodeAndGroupCodeAttrMappingDTO> codeAndGroupCodeAttrMappingDTOList= execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); |
| | | |
| | | Map<String, CodeAndGroupCodeAttrMappingDTO> jAttrVOMap = codeAndGroupCodeAttrMappingDTOList.stream().filter(s-> finalFieldList.contains(s.getTargetAttrKey().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getTargetAttrKey().toLowerCase(Locale.ROOT), t -> t)); |
| | | |
| | | WriteExcelData codeExcelData = new WriteExcelData(0, 0, "ä¼ä¸ç¼ç "); |
| | | WriteExcelData groupExcelData = new WriteExcelData(0, 1, "éå¢ç "); |
| | | excelDataList.add(codeExcelData); |
| | |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public String improtGroupCode(String codeClassifyOid, File file) throws ServiceException { |
| | | @Transactional(rollbackFor = VciBaseException.class) |
| | | @Override |
| | | public String importGroupCode(String codeClassifyOid, File file) throws Throwable { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"åç±»ç主é®"); |
| | | ReadExcelOption reo = new ReadExcelOption(); |
| | | reo.setReadAllSheet(true); |
| | |
| | | throw new ServiceException("为äºä¿è¯ç³»ç»çç¨³å®æ§ï¼è¯·ä¸æ¬¡ä¸è¦å¯¼å
¥è¶
è¿1䏿¡çæ°æ®"); |
| | | } |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); |
| | | CodeClassifyTemplateVO templateVO = new CodeClassifyTemplateVO(); |
| | | //é¤å»é»è®¤ç屿§.è¿æåªæè¡¨åæ¾ç¤ºçåæ®µæå¯¼å
¥ |
| | | //è·åææ°çæ¨¡æ¿ |
| | | CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid); //é¤å»é»è®¤ç屿§.è¿æåªæè¡¨åæ¾ç¤ºçåæ®µæå¯¼å
¥ |
| | | List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->!DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) |
| | | ).collect(Collectors.toList()); |
| | | ExecGroupCodePortDataDTO execGroupCodePortDataDTO=new ExecGroupCodePortDataDTO(); |
| | | createExportGroupCodeMapConfig(templateVO,execGroupCodePortDataDTO);//ç»ç»æ°æ® |
| | | List<CodeAndGroupCodeAttrMappingDTO> codeAttrMapGroupAttrDTOS=execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); |
| | | if(!CollectionUtils.isEmpty(codeAttrMapGroupAttrDTOS)){ |
| | | if(CollectionUtils.isEmpty(codeAttrMapGroupAttrDTOS)){ |
| | | throw new ServiceException("éå¢å±æ§æ å°æªé
ç½®"); |
| | | } |
| | | Map<String, CodeAndGroupCodeAttrMappingDTO> codeSystemObjectMap = codeAttrMapGroupAttrDTOS.stream().filter(codeAttrMappingDTO -> codeAttrMappingDTO != null && StringUtils.isNotBlank(codeAttrMappingDTO.getSourceAttrName())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceAttrName(), t -> t)); |
| | |
| | | Map<Integer/**åå·**/,String/**åæ®µçåç§°**/> fieldIndexMap = new HashMap<>(); |
| | | getGroupCodeFieldIndexMap(titleRowData,codeAttrMapGroupAttrDTOS,fieldIndexMap); |
| | | //éè¦å¤ææ¯å¦ææç屿§é½å¨æ¨¡æ¿ä¸äº |
| | | List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) |
| | | /** List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) |
| | | && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getComponentRule()) && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getClassifyInvokeAttr())//ç»åè§ååå类注å
¥ç¡®å®æ²¡ç»ç¨æ·å¯¼åºå» |
| | | ).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(unExistAttrVOs)){ |
| | | String message=unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName).collect(Collectors.joining(SERIAL_UNIT_SPACE)); |
| | | throw new VciBaseException("ã" + message + "ãè¿äºå±æ§å¨excel䏿²¡ææ¾å°"); |
| | | } |
| | | }**/ |
| | | List<ClientBusinessObject> cboList = new ArrayList<>(); |
| | | List<SheetRowData> rowDataList = dataSet.getRowData(); |
| | | |
| | | getExportGroupCodeDatas(fieldIndexMap,rowDataList,cboList);//æå»ºæ°æ®å¯¹è±¡ |
| | | |
| | | List<String> codeList= cboList.stream().map(ClientBusinessObject::getId).collect(Collectors.toList()); |
| | | List<Map<String,String>>dataList=new ArrayList<>(); |
| | | getDatas(classifyFullInfo,templateVO,execGroupCodePortDataDTO.getFieldList(),dataList,codeList); |
| | | //æ¥è¯¢ç³»ç»ä¸åå¨ |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | Map<String,String> errorMap=new HashMap<>(); |
| | | batchSwitchCheckExist(errorMap,cboList,classifyFullInfo,templateVO,execGroupCodePortDataDTO,fieldIndexMap); |
| | | //夿å¿
è¾é¡¹ |
| | | batchCheckRequiredAttrOnOrder(templateVO, cboList, errorMap); |
| | | // //ä¼å
æ ¡éªç¼ç æ¯å¦åå¨ |
| | | // batchCheckIdExistOnOrder(templateVO, cboList, errorMap); |
| | | //boolean |
| | | reSwitchBooleanAttrOnOrder(attrVOS, cboList); |
| | | |
| | | // æä¸¾çå
容éè¦æ ¹æ®å称转æ¢ä¸ºæä¸¾çå¼ |
| | | batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap); |
| | | |
| | | batchSwitchReferAttrOnOrder(attrVOS, cboList, errorMap); |
| | | //6.å¤çå类注å
¥ |
| | | batchSwitchClassifyAttrOnOrder(attrVOS, cboList, classifyFullInfo,false); |
| | | |
| | | //设置é»è®¤å¼ |
| | | batchSwitchAttrDefault(attrVOS, cboList); |
| | | |
| | | //7.å¤çç»åè§å |
| | | batchSwitchComponentAttrOnOrder(attrVOS, cboList); |
| | | //4.æ ¡éªè§å |
| | | batchCheckVerifyOnOrder(attrVOS, cboList, errorMap); |
| | | //6.æ¶é´çï¼å¿
é¡»ç»ä¸ä¸ºyyyy-MM-dd HH:mm:ss |
| | | batchSwitchDateAttrOnOrder(attrVOS, cboList, errorMap); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,true,errorMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { |
| | | selfRepeatRowIndexList.stream().forEach(rowIndex -> { |
| | | errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";å¨å½åexcelæä»¶ä¸å
³é®å±æ§éå¤"); |
| | | }); |
| | | } |
| | | return ""; |
| | | } |
| | | if (!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)) { |
| | | keyAttrRepeatRowIndexList.stream().forEach(rowIndex -> { |
| | | errorMap.put(rowIndex, "å
³é®å±æ§ä¸ç³»ç»ä¸çéå¤;" + errorMap.getOrDefault(rowIndex, "")); |
| | | }); |
| | | } |
| | | Map<String,List<WriteExcelData>> shetNameMap=new HashMap<>(); |
| | | createWriteExcelData(rowDataList, errorMap, new ArrayList<>(), titleRowData, shetNameMap, templateVO); |
| | | String excelFileName=""; |
| | | if(errorMap.size()==0) { |
| | | try { |
| | | String btmTypeId = classifyFullInfo.getTopClassifyVO().getBtmTypeId(); |
| | | List<BaseModel>oldCbos= execGroupCodePortDataDTO.getOldList(); |
| | | List<BaseModel>newCbos=new ArrayList<>(); |
| | | // ä¿®æ¹çæ¬¡å· |
| | | engineService.updateBatchByBaseModel(btmTypeId,oldCbos); |
| | | List<CodeAllCode> codeAllCodeList=new ArrayList<>(); |
| | | |
| | | cboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel newBaseModel=new BaseModel(); |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(clientBusinessObject.getData(),newBaseModel,true); |
| | | newCbos.add(newBaseModel); |
| | | }); |
| | | // æå
¥æ°çæ°æ® |
| | | engineService.insertBatchByType(btmTypeId, newCbos); |
| | | codeAllCodeService.saveOrUpdateBatch(execGroupCodePortDataDTO.getCodeAllCodeList()); |
| | | engineService.batchSaveSelectChar(templateVO, newCbos); |
| | | // è®°å½æ°æ®æ´æ¹æ¥å¿ |
| | | saveLogUtil.operateLog("æ°æ®æ´æ¹", false, StringUtil.format("{}\nä¿®æ¹ä¸º:\n{}", JSON.toJSONString(oldCbos), JSON.toJSONString(newCbos))); |
| | | } catch (Exception vciError) { |
| | | // è®°å½æ°æ®æ´æ¹æ¥éæ¶çæ¥å¿ |
| | | saveLogUtil.operateLog("æ°æ®æ´æ¹", true, vciError.toString()); |
| | | throw new VciBaseException("æ°æ®æ´æ¹ä¿ååºéäº", new String[0], vciError); |
| | | } |
| | | }else{ |
| | | excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + "é误信æ¯.xls"; |
| | | WriteExcelOption eo = new WriteExcelOption(); |
| | | shetNameMap.forEach((shetName, errorDataList) -> { |
| | | eo.addSheetDataList(shetName, errorDataList); |
| | | }); |
| | | try { |
| | | new File(excelFileName).createNewFile(); |
| | | } catch (IOException e) { |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e)); |
| | | } |
| | | ExcelUtil.writeDataToFile(excelFileName, eo); |
| | | } |
| | | return excelFileName; |
| | | } |
| | | public void batchSwitchCheckExist(Map<String,String> errorMap,List<ClientBusinessObject> cboList,CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,ExecGroupCodePortDataDTO execGroupCodePortDataDTO,Map<Integer/**åå·**/,String/**åæ®µçåç§°**/> fieldIndexMap){ |
| | | List<BaseModel> oldBaseModelList=new ArrayList<>(); |
| | | List<CodeAllCode> codeAllCodeList=new ArrayList<>(); |
| | | cboList.stream().forEach(clientBusinessObject -> { |
| | | String code=clientBusinessObject.getId(); |
| | | String rowIndex=clientBusinessObject.getAttributeValue(IMPORT_ROW_INDEX); |
| | | List<Map<String,String>>dataList=new ArrayList<>(); |
| | | List<String> fieldList= execGroupCodePortDataDTO.getFieldList(); |
| | | getDatas(classifyFullInfo,templateVO,execGroupCodePortDataDTO.getFieldList(),dataList,Arrays.asList(code)); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | Map<String,String> newDataMap=new HashMap<>();//å°æ°å¯¹è±¡å±æ§ææ¶åå¨å¨Map<> |
| | | newDataMap.putAll(clientBusinessObject.getData()); |
| | | Map<String,String> dataMap=dataList.get(0); |
| | | BaseModel oldBaseModel=new BaseModel(); |
| | | |
| | | DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,oldBaseModel,false); |
| | | String oldOid=oldBaseModel.getOid(); |
| | | |
| | | clientBusinessObject.setCopyFromVersion(oldOid); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("copyfromversion",oldOid); |
| | | String oid=VciBaseUtil.getPk(); |
| | | clientBusinessObject.setOid(oid); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("oid",oid); |
| | | clientBusinessObject.setBtmname(oldBaseModel.getBtmname()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("btmname",oldBaseModel.getBtmname()); |
| | | clientBusinessObject.setLastR("1"); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lastr","1"); |
| | | clientBusinessObject.setFirstR("1"); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("firstr","1"); |
| | | clientBusinessObject.setFirstV("1"); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("firstv","1"); |
| | | clientBusinessObject.setLastV("1"); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lastv","1"); |
| | | clientBusinessObject.setRevisionSeq(1); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("revisionseq","1"); |
| | | clientBusinessObject.setVersionSeq(1); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("versionseq","1"); |
| | | clientBusinessObject.setRevisionRule(oldBaseModel.getRevisionRule()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("revisionrule",oldBaseModel.getRevisionRule()); |
| | | clientBusinessObject.setVersionRule(oldBaseModel.getRevisionRule()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("versionrule",oldBaseModel.getVersionRule()); |
| | | clientBusinessObject.setVersionValue(oldBaseModel.getVersionValue()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("versionvalue",oldBaseModel.getVersionValue()); |
| | | clientBusinessObject.setLctid(oldBaseModel.getLctid()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lctid",oldBaseModel.getLctid()); |
| | | clientBusinessObject.setId(oldBaseModel.getId()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("id",oldBaseModel.getId()); |
| | | clientBusinessObject.setName(oldBaseModel.getName()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("name",oldBaseModel.getName()); |
| | | clientBusinessObject.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lcstatus",CodeDefaultLC.RELEASED.getValue()); |
| | | clientBusinessObject.setDescription("导å
¥éå¢ç "); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("description","导å
¥éå¢ç "); |
| | | clientBusinessObject.setOwner("1"); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("owner","1"); |
| | | clientBusinessObject.setTenantId(AuthUtil.getTenantId()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("tenant_id",AuthUtil.getTenantId()); |
| | | clientBusinessObject.setCreator(oldBaseModel.getCreator()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("creator",oldBaseModel.getCreator()); |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | clientBusinessObject.setCreateTime(oldBaseModel.getCreateTime()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("createtime", formatter.format(oldBaseModel.getCreateTime())); |
| | | clientBusinessObject.setLastModifier(AuthUtil.getUserAccount()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lastmodifier",AuthUtil.getUserAccount()); |
| | | clientBusinessObject.setCreateTime(new Date()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("lastmodifytime", formatter.format(new Date())); |
| | | clientBusinessObject.setRevisionValue(String.valueOf(Integer.parseInt(oldBaseModel.getRevisionValue())+1)); |
| | | clientBusinessObject.setRevisionOid(oldBaseModel.getRevisionOid()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("revisionoid",oldBaseModel.getRevisionOid()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("revisionvalue",String.valueOf(Integer.parseInt(oldBaseModel.getRevisionValue())+1)); |
| | | |
| | | clientBusinessObject.setNameOid(oldBaseModel.getNameOid()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("nameoid",oldBaseModel.getNameOid()); |
| | | |
| | | clientBusinessObject.setAttributeValueWithNoCheck(CODE_CLASSIFY_OID_FIELD,oldBaseModel.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,"")); |
| | | clientBusinessObject.setAttributeValueWithNoCheck(CODE_FULL_PATH_FILED,oldBaseModel.getData().getOrDefault(CODE_FULL_PATH_FILED,"")); |
| | | clientBusinessObject.setAttributeValueWithNoCheck(CODE_TEMPLATE_OID_FIELD,oldBaseModel.getData().getOrDefault(CODE_TEMPLATE_OID_FIELD,"")); |
| | | clientBusinessObject.setTs(new Date()); |
| | | clientBusinessObject.setAttributeValueWithNoCheck("ts",formatter.format(new Date())); |
| | | oldBaseModel.setLastV("0"); |
| | | oldBaseModel.getData().put("lastv","0"); |
| | | oldBaseModelList.add(oldBaseModel); |
| | | List<CodeAllCode> oldCodeAllCodeList= codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getId,code)); |
| | | CodeAllCode codeAllCode=new CodeAllCode(); |
| | | if(!CollectionUtils.isEmpty(oldCodeAllCodeList)){ |
| | | codeAllCode=oldCodeAllCodeList.get(0); |
| | | codeAllCode.setId(code); |
| | | codeAllCode.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | codeAllCode.setCreateCodeOid(clientBusinessObject.getOid()); |
| | | codeAllCode.setCreateCodeBtm(clientBusinessObject.getBtmname()); |
| | | codeAllCode.setLastModifyTime(new Date()); |
| | | codeAllCode.setLastModifier(AuthUtil.getUserAccount()); |
| | | codeAllCodeList.add(codeAllCode); |
| | | if(!oldBaseModel.getLcStatus().equals(CodeDefaultLC.RELEASED.getValue())||!codeAllCode.getLcStatus().equals(CodeDefaultLC.RELEASED.getValue())){ |
| | | errorMap.put(rowIndex,"第"+rowIndex+"è¡ï¼å¨ç³»ç»ä¸æ°æ®ä¸æ¯åå¸ç¶æ"); |
| | | } |
| | | }else{ |
| | | errorMap.put(rowIndex,"第"+rowIndex+"è¡ï¼å¨ç³»ç»ä¸æªæ¥è¯¢å°ç¸åºçç 弿°æ®"); |
| | | } |
| | | //é¤å»é»è®¤ç屿§.è¿æåªæè¡¨åæ¾ç¤ºçåæ®µæå¯¼å
¥ |
| | | List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->!fieldIndexMap.containsValue(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) |
| | | ).collect(Collectors.toList()); |
| | | attrVOS.stream().forEach(codeClassifyTemplateAttrVO -> {//å°ä¸éè¦æ´æ¹çé»è®¤å段æè
䏿´æ¹ç屿§å¤å¶å°æ°ççæ¬ä¸ |
| | | String arrtibuteKey=codeClassifyTemplateAttrVO.getId(); |
| | | Map<String,String>attrDataMap=oldBaseModel.getData(); |
| | | if(attrDataMap.containsKey(arrtibuteKey)){ |
| | | String arrtibuteValue=attrDataMap.get(arrtibuteKey); |
| | | clientBusinessObject.setAttributeValueWithNoCheck(arrtibuteKey,arrtibuteValue); |
| | | } |
| | | }); |
| | | }else{ |
| | | errorMap.put(rowIndex,"第"+rowIndex+"è¡ï¼å¨ç³»ç»ä¸æªæ¥è¯¢å°ç¸åºçææ°çæ°æ®"); |
| | | } |
| | | }); |
| | | execGroupCodePortDataDTO.setOldList(oldBaseModelList); |
| | | execGroupCodePortDataDTO.setCodeAllCodeList(codeAllCodeList); |
| | | } |
| | | /** |
| | | * |
| | | * @param fieldIndexMap |
| | |
| | | */ |
| | | private void getExportGroupCodeDatas(Map<Integer,String> fieldIndexMap,List<SheetRowData> rowDataList,List<ClientBusinessObject>cboList){ |
| | | rowDataList.stream().forEach(sheetRowData -> { |
| | | String rowIndex= sheetRowData.getRowIndex(); |
| | | ClientBusinessObject cbo=new ClientBusinessObject(); |
| | | cbo.setAttributeValue(IMPORT_ROW_INDEX,rowIndex); |
| | | sheetRowData.getData().forEach((index,value)->{ |
| | | ClientBusinessObject cbo=new ClientBusinessObject(); |
| | | String field = fieldIndexMap.get(index); |
| | | if (StringUtils.isBlank(field)) { |
| | | throw new VciBaseException("第" + (index + 1) + "åçæ é¢å¨ç³»ç»ä¸ä¸åå¨"); |
| | |
| | | } catch (VciBaseException e) { |
| | | log.error("è®¾ç½®å±æ§çå¼é误", e); |
| | | } |
| | | cboList.add(cbo); |
| | | }); |
| | | cboList.add(cbo); |
| | | }); |
| | | } |
| | | /*** |
| | |
| | | Map<String, CodeAndGroupCodeAttrMappingDTO> codeSystemObjectMap = codeAttrMapGroupAttrDTOS.stream().filter(codeAttrMappingDTO -> codeAttrMappingDTO != null && StringUtils.isNotBlank(codeAttrMappingDTO.getSourceAttrName())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceAttrName(), t -> t)); |
| | | for (int i = 0; i < titleRowData.size(); i++) { |
| | | String title = titleRowData.get(i); |
| | | CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO =codeSystemObjectMap.get(title.replace(KEY_ATTR_CHAR,"").replace(REQUIRED_CHAR,"")); |
| | | String id=codeAndGroupCodeAttrMappingDTO.getTargetAttrKey(); |
| | | if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "éå¢ç ".equalsIgnoreCase(title)){ |
| | | String id = ""; |
| | | if ("éå¢ç ".equalsIgnoreCase(title)) { |
| | | id = CODE_GROUP_FIELD; |
| | | } |
| | | if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "ä¼ä¸ç¼ç ".equalsIgnoreCase(title)){ |
| | | if ("ä¼ä¸ç¼ç ".equalsIgnoreCase(title)) { |
| | | id = CODE_FIELD; |
| | | } |
| | | if(com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)){ |
| | | fieldIndexMap.put(i,id); |
| | | if(codeSystemObjectMap.containsKey(title)) { |
| | | CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO = codeSystemObjectMap.get(title.replace(KEY_ATTR_CHAR, "").replace(REQUIRED_CHAR, "")); |
| | | id = codeAndGroupCodeAttrMappingDTO.getTargetAttrKey(); |
| | | } |
| | | if (com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)) { |
| | | fieldIndexMap.put(i, id); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param selectFieldList |
| | | * @param dataList |
| | | */ |
| | | private void getDatas(CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,LinkedList<String> selectFieldList,List<Map<String,String>>dataList,List<String> codeList ){ |
| | | private void getDatas(CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,LinkedList<String> selectFieldList,List<Map<String,String>>dataList,List<String> codeList){ |
| | | //å
æ¥è¯¢æ°æ® |
| | | String btmTypeId = classifyFullInfo.getTopClassifyVO().getBtmTypeId(); |
| | | String codeClassifyOid=classifyFullInfo.getCurrentClassifyVO().getOid(); |