| | |
| | | import com.vci.ubcs.code.vo.webserviceModel.attrmap.RowDatas; |
| | | import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO; |
| | | 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.starter.bo.WriteExcelData; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.ubcs.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.KeyValue; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.pagemodel.UIFormReferVO; |
| | | import com.vci.ubcs.starter.web.pagemodel.*; |
| | | import com.vci.ubcs.starter.web.toolmodel.DateConverter; |
| | | import com.vci.ubcs.starter.web.util.*; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import org.apache.poi.ss.usermodel.Font; |
| | | import org.apache.poi.ss.usermodel.RichTextString; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.redis.cache.BladeRedis; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | |
| | | */ |
| | | @Autowired |
| | | private IBtmTypeClient btmTypeClient; |
| | | /*** |
| | | * 密级服务 |
| | | */ |
| | | @Resource |
| | | private IWebSecretClient secretService; |
| | | /** |
| | | * 批量申请:选取选中分类下的所有模板关键属性,相似属性,必填属性,写入execl中 |
| | | * |
| | |
| | | String field=codetemplateAttr.getId(); |
| | | String name=codetemplateAttr.getName(); |
| | | CodeClassifyTemplateAttrVO codeBaseAttributeDTO=new CodeClassifyTemplateAttrVO(); |
| | | boolean res=codetemplateAttr.getAttributeGroup().equals(BATCHADD_EXCEPORT_ATTR_TYPE)//基本属性字段显示 |
| | | boolean res=(StringUtils.isNotBlank(codetemplateAttr.getAttributeGroup())&& codetemplateAttr.getAttributeGroup().equals(BATCHADD_EXCEPORT_ATTR_TYPE))//基本属性字段显示 |
| | | ||(StringUtils.isNotBlank(codetemplateAttr.getKeyAttrFlag())&&Boolean.parseBoolean(codetemplateAttr.getKeyAttrFlag()))//关键属性的存入 |
| | | ||(StringUtils.isNotBlank(codetemplateAttr.getSameRepeatAttrFlag())&&Boolean.parseBoolean(codetemplateAttr.getSameRepeatAttrFlag())) //相似属性的存入 |
| | | ||(StringUtils.isNotBlank(codetemplateAttr.getRequireFlag())&&Boolean.parseBoolean(codetemplateAttr.getRequireFlag())); |
| | |
| | | //参照的自行输入名称 |
| | | //分类注入的不用,都是导入后自动处理的 |
| | | //编码,状态等字段不导入 |
| | | List<CodeClassifyTemplateAttrVO> templateAttrVOS = codeClassifyTemplateVO.getAttributes().stream().filter(s -> |
| | | List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOList=codeClassifyTemplateVO.getAttributes(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrVOList)) { |
| | | if (CollectionUtils.isEmpty(codeClassifyTemplateAttrVOList)) { |
| | | throw new VciBaseException("模板没有配置属性"); |
| | | } |
| | | } |
| | | List<CodeClassifyTemplateAttrVO> templateAttrVOS = codeClassifyTemplateAttrVOList.stream().filter(s -> |
| | | !DEFAULT_ATTR_LIST.contains(s.getId()) |
| | | && StringUtils.isBlank(s.getComponentRule()) |
| | | && StringUtils.isBlank(s.getClassifyInvokeAttr()) |
| | | && (isHistory || VciBaseUtil.getBoolean(s.getFormDisplayFlag())) |
| | | ).collect(Collectors.toList()); |
| | | |
| | | if(CollectionUtils.isEmpty(templateAttrVOS)){ |
| | | throw new VciBaseException("模板没有配置任何【表单显示】为【是】的属性"); |
| | | } |
| | | if (CollectionUtils.isEmpty(templateAttrVOS)) { |
| | | throw new VciBaseException("模板没有配置任何【表单显示】为【是】的属性"); |
| | | } |
| | | |
| | | List<CodeClassifyTemplateAttrVO> idAttrVOList = codeClassifyTemplateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList()); |
| | | LinkedList<WriteExcelData> excelDataList = new LinkedList<>(); |
| | | Workbook workbook = new HSSFWorkbook(); |
| | |
| | | * @return 有错误信息的excel |
| | | */ |
| | | @Override |
| | | public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) { |
| | | public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) throws Throwable{ |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键"); |
| | | ReadExcelOption reo = new ReadExcelOption(); |
| | | reo.setReadAllSheet(true); |
| | |
| | | if (isExport||newErrorMap.size() > 0) { |
| | | createRedisDatas(uuid + "-ok", templateVO, rowIndexCboMap, dataSet, fieldIndexMap, newErrorMap, true); |
| | | } else { |
| | | List<String> dataCBOIdList=new ArrayList<>(); |
| | | List<BaseModel> dataCBOIdList=new ArrayList<>(); |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | List<ClientBusinessObject> finalNeedSaveCboList = needSaveCboList; |
| | | CodeClassifyTemplateVO finalTemplateVO = templateVO; |
| | |
| | | thisCbos.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | //baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | dataCBOIdList.add(baseModel.getOid()); |
| | | dataCBOIdList.add(baseModel); |
| | | }); |
| | | |
| | | if (!CollectionUtils.isEmpty(thisCbos)) { |
| | |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";系统错误,存储数据的时候出错了"); |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }); |
| | | if (errorMap.size() > 0) { |
| | | isExport = true; |
| | | } |
| | | createWriteExcelData(rowDataList, errorMap, new ArrayList<>(), titleRowData, shetNameMap, finalTemplateVO); |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOIdList); |
| | | } |
| | | } |
| | |
| | | |
| | | return codeImProtRusultVO; |
| | | } |
| | | /*private void converBaseModels(List<ClientBusinessObject> clientBusinessObjects,List<BaseModel>dataCBOList){ |
| | | clientBusinessObjects.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | Map<String,String> dataMap=new HashMap<>(); |
| | | clientBusinessObject.getHisAttrValList() |
| | | baseModel.setData(VciBaseUtil.objectToMapString(baseModel)); |
| | | |
| | | AttributeValue[] newAttributeValue= clientBusinessObject.getNewAttrValList(); |
| | | dataCBOList.add(baseModel); |
| | | }); |
| | | |
| | | }*/ |
| | | /*** |
| | | * 从execl里构建对象 |
| | | * @param rowDataList |
| | |
| | | cboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | //baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | dataCBOIdList.add(baseModel.getOid()); |
| | | }); |
| | | try { |
| | | codeList = productCodeService.productCodeAndSaveData(classifyFullInfo,templateVO,ruleVO, orderDTO.getSecDTOList(),dataCBOList); |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOIdList); |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("批了申请时失败"); |
| | |
| | | public List<CodeImportTemplateVO> gridclassifys(String redisOid) { |
| | | List<CodeImportTemplateVO> codeImportTemplateVOs=new ArrayList<>(); |
| | | VciBaseUtil.alertNotNull(redisOid,"分类",redisOid,"分类缓存主键"); |
| | | |
| | | List<CodeImportTemplateVO> redisServiceCacheObjects=bladeRedis.lRange(redisOid,0,-1); |
| | | List<CodeImportTemplateVO> redisServiceCacheObjects=bladeRedis.get(redisOid); |
| | | if(redisServiceCacheObjects!=null){ |
| | | codeImportTemplateVOs= redisServiceCacheObjects; |
| | | } |
| | |
| | | @Override |
| | | public DataGrid<Map<String, String>> gridDatas(String codeClssifyOid, String redisOid) { |
| | | VciBaseUtil.alertNotNull(redisOid,"导入相似数据",redisOid,"数据缓存主键"); |
| | | List<CodeImprotDataVO> codeImprotDataVOs = bladeRedis.lRange(redisOid+"-"+codeClssifyOid,0,-1); |
| | | List<CodeImprotDataVO> codeImprotDataVOs = bladeRedis.get(redisOid+"-"+codeClssifyOid); |
| | | // redisService.getCacheList(redisOid+"-"+codeClssifyOid); |
| | | CodeImprotDataVO codeImprotDataVO=new CodeImprotDataVO(); |
| | | if(!CollectionUtils.isEmpty(codeImprotDataVOs)){ |
| | |
| | | @Override |
| | | public DataGrid<Map<String,String>> gridRowResemble(String oid,String redisOid){ |
| | | VciBaseUtil.alertNotNull(redisOid,"导入相似数据",redisOid,"数据缓存主键"); |
| | | List<DataResembleVO> codeImprotDataVOs = bladeRedis.lRange(redisOid,0,-1);; |
| | | List<DataResembleVO> codeImprotDataVOs = bladeRedis.get(redisOid);; |
| | | DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); |
| | | List<Map<String, String>> dataList = new ArrayList<>(); |
| | | |
| | |
| | | |
| | | @Override |
| | | public R batchImportData(List<CodeImprotSaveDatVO> codeImprotSaveDatVOList, String classifyAttr, boolean isImprot) { |
| | | List<String> allNeedSaveCboList=new ArrayList<>(); |
| | | |
| | | boolean success=true; |
| | | codeImprotSaveDatVOList.stream().forEach(codeImprotSaveDatVO -> { |
| | | List<SheetRowData> rowDataList = new ArrayList<>(); |
| | | List<ClientBusinessObject>cboList=new ArrayList<>(); |
| | |
| | | String fullPath = getFullPath(classifyFullInfo); |
| | | excelToCbo(classifyFullInfo,fieldIndexMap,rowDataList, codeClassifyTemplateVO,cboList,fullPath,!isImprot); |
| | | Map<String,String> errorMap=new HashMap<>(); |
| | | Map<String/**路径**/, CodeClassifyVO> pathMap=new HashMap<>() ; |
| | | //校验编码规则和码段是否正确 |
| | | Map<String, List<String>> ruleRowIndexMap = new ConcurrentHashMap<>(); |
| | | Map<String, CodeRuleVO> ruleVOMap =new ConcurrentHashMap<>(); |
| | | if(isImprot) { |
| | | Map<String/**主键**/, String/**路径**/> childOidPathMap = getChildClassifyPathMap(classifyFullInfo, fullPath); |
| | | //都转换完了。需要批量检查 |
| | | //找所有的分类路径,需要校验路径是否正确,是否都在当前的分类的下级 |
| | | List<CodeClassifyVO> childClassifyVOs = classifyService.listChildrenClassify(orderDTO.getCodeClassifyOid(), true, classifyAttr, true); |
| | | Map<String/**路径**/, CodeClassifyVO> pathMap = Optional.ofNullable(childClassifyVOs).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getPath().startsWith("#") ? s.getPath().substring(1) : s.getPath(), t -> t)); |
| | | pathMap = Optional.ofNullable(childClassifyVOs).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getPath().startsWith("#") ? s.getPath().substring(1) : s.getPath(), t -> t)); |
| | | Map<String/**主键**/, CodeClassifyVO> classifyVOMap = Optional.ofNullable(childClassifyVOs).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | classifyVOMap.put(classifyFullInfo.getCurrentClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO()); |
| | | pathMap.put("#current#", classifyFullInfo.getCurrentClassifyVO()); |
| | | //我们需要判断这些分类的模板是不是一样的,只需要校验,不用获取 |
| | | //检查分类的路径 |
| | | checkClassifyPathInHistory(cboList, errorMap, pathMap, childOidPathMap); |
| | | //检查规则 |
| | | Map<String/**分类主键**/, String/**规则主键**/> ruleOidMap = new ConcurrentHashMap<String, String>(); |
| | | List<String> unExistRuleClassifyOidList = new CopyOnWriteArrayList<>(); |
| | | checkRuleOidInHistory(classifyVOMap, ruleOidMap, unExistRuleClassifyOidList); |
| | | ruleVOMap = ruleService.listCodeRuleByIds(ruleOidMap.values(), true).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | |
| | | checkSecLengthInHistory(cboList, classifyVOMap, ruleVOMap, ruleOidMap, errorMap, ruleRowIndexMap); |
| | | } |
| | | |
| | | //分类注入 |
| | | batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,isImprot); |
| | | //boolean |
| | |
| | | //4.校验规则 |
| | | batchCheckVerifyOnOrder(attrVOS, cboList,errorMap); |
| | | |
| | | |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | List<ClientBusinessObject>needSaveCboList = cboList.stream().filter(cbo -> { |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | return !errorMap.containsKey(rowIndex); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | log.info("分类:"+classifyFullInfo.getCurrentClassifyVO().getName()+"数据:"+needSaveCboList.size()); |
| | | if (!CollectionUtils.isEmpty(needSaveCboList)) { |
| | | List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | needSaveCboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | allNeedSaveCboList.add(baseModel.getOid()); |
| | | }); |
| | | try { |
| | | //9.我们处理业务数据 |
| | | if (isImprot) { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, codeClassifyTemplateVO, ruleVO, null, dataCBOList); |
| | | }else { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, codeClassifyTemplateVO, ruleVO, orderDTO.getSecDTOList(), dataCBOList); |
| | | if(isImprot){ |
| | | List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> { |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | return !errorMap.containsKey(rowIndex); |
| | | }).collect(Collectors.toList()); |
| | | List<ClientBusinessObject> finalNeedSaveCboList = needSaveCboList; |
| | | Map<String, CodeRuleVO> finalRuleVOMap = ruleVOMap; |
| | | ruleRowIndexMap.keySet().parallelStream().forEach(ruleOid -> { |
| | | List <BaseModel>dataCBOList=new CopyOnWriteArrayList<>(); |
| | | List<String> rowIndexList = ruleRowIndexMap.get(ruleOid); |
| | | List<ClientBusinessObject> thisCbos = needSaveCboList.stream().filter(cbo -> rowIndexList.contains(cbo.getAttributeValue(IMPORT_ROW_INDEX)) && !errorMap.containsKey(cbo.getAttributeValue(IMPORT_ROW_INDEX))).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(thisCbos)) { |
| | | thisCbos.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel = new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject, baseModel); |
| | | dataCBOList.add(baseModel); |
| | | }); |
| | | try { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, codeClassifyTemplateVO, finalRuleVOMap.get(ruleOid), null, dataCBOList); |
| | | } catch (Throwable e) { |
| | | //success=false; |
| | | log.error("批量产生编码的时候出错了", e); |
| | | thisCbos.stream().forEach(cbo -> { |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";系统错误,存储数据的时候出错了"); |
| | | }); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | engineService.batchSaveSelectChar(codeClassifyTemplateVO, dataCBOList); |
| | | }); |
| | | }else { |
| | | List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> { |
| | | String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); |
| | | return !errorMap.containsKey(rowIndex); |
| | | }).collect(Collectors.toList()); |
| | | log.info("分类:" + classifyFullInfo.getCurrentClassifyVO().getName() + "数据:" + needSaveCboList.size()); |
| | | if (!CollectionUtils.isEmpty(needSaveCboList)) { |
| | | needSaveCboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel = new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject, baseModel); |
| | | dataCBOList.add(baseModel); |
| | | }); |
| | | try { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, codeClassifyTemplateVO, ruleVO, orderDTO.getSecDTOList(), dataCBOList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(codeClassifyTemplateVO, dataCBOList); |
| | | } |
| | | } |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(codeClassifyTemplateVO, allNeedSaveCboList); |
| | | }); |
| | | return R.success(isImprot?"批量历史导入成功":"批量申请成功"); |
| | | } |
| | |
| | | needSaveCboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | //(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | allNeedSaveCboList.add(baseModel.getOid()); |
| | | }); |
| | | try { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), dataCBOList); |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(templateVO, allNeedSaveCboList); |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOList); |
| | | // if(!isProcess){ |
| | | needSaveCboList.stream().forEach(needSaveCbo->{ |
| | | XMLResultDataObjectDetailDO resultDataObjectDetailDO=new XMLResultDataObjectDetailDO(); |
| | |
| | | * @param dataObjectVO 数据信息 |
| | | * @param resultDataObjectDetailDOs 错误信息 |
| | | */ |
| | | @Transactional(rollbackFor = VciBaseException.class) |
| | | @Override |
| | | public void batchSyncEditDatas(CodeClassifyVO codeClassifyVO, DataObjectVO dataObjectVO, LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs) { |
| | | String errorid=""; |
| | |
| | | getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap); |
| | | Map<String, String> cboOidMap = new HashMap<>(); |
| | | cboOidMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDataMap.keySet().toArray(new String[0])) + ")"); |
| | | R<BtmTypeVO> r= btmTypeClient.getDetail(templateVO.getBtmTypeId()); |
| | | BtmTypeVO btmTypeVO =r.getData(); |
| | | String tableName=btmTypeVO.getTableName(); |
| | | String tableName =""; |
| | | try { |
| | | R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId()); |
| | | if(r.getCode()!=200) { |
| | | throw new Throwable(r.getMsg()); |
| | | } |
| | | BtmTypeVO btmTypeVO = r.getData(); |
| | | if (btmTypeVO == null) { |
| | | throw new Throwable("根据业务类型未查询到业务类型对象!"); |
| | | } |
| | | tableName = btmTypeVO.getTableName(); |
| | | if (StringUtils.isBlank(tableName)) { |
| | | throw new Throwable("根据业务类型未查询到业务类型相关联的表"); |
| | | } |
| | | }catch (Throwable e){ |
| | | log.error("查询业务对象表"+e); |
| | | XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO=new XMLResultDataObjectDetailDO(); |
| | | xmlResultDataObjectDetailDO.setErrorid("103"); |
| | | xmlResultDataObjectDetailDO.setMsg("查询业务对象表"+e); |
| | | xmlResultDataObjectDetailDO.setId(""); |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | return; |
| | | } |
| | | |
| | | StringBuffer sb=new StringBuffer(); |
| | | sb.append(" select * from "); |
| | |
| | | |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(cbo,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | | //baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | | updateList.add(baseModel); |
| | | }else if(operation.equals("delete")){//如果在流程中不允许删除,不在流程中状态为发布或者停用的数据不允许删除,将其更改为停用,其他的情况直接删除 |
| | | // if(finalIsProcess){ |
| | |
| | | |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(cbo,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | | //baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | | updateList.add(baseModel); |
| | | }catch (VciBaseException e) { |
| | | e.printStackTrace(); |
| | |
| | | } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) { |
| | | sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; |
| | | } |
| | | sql[0] += " and islastR = '1' and islastV = '1' "; |
| | | sql[0] += " and lastR = '1' and lastV = '1' "; |
| | | if (commonsMapper.queryCountBySql(sql[0]) > 0) { |
| | | String ruleInfoMsg = keyRuleVO == null ? "" : "查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}"; |
| | | String[] objs = new String[]{trim ? "是" : "否", ignoreCase ? "是" : "否", ignoreWidth ? "是" : "否", trimAll ? "是" : "否"}; |
| | |
| | | |
| | | } |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if (secret == 0 || !secretService.checkDataSecret(secret)) { |
| | | if (secret == 0 || !secretService.checkDataSecret(secret).getData()) { |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret)); |
| | | }*/ |
| | | } |
| | | } catch (Throwable e) { |
| | | log.error("设置默认的属性的值错误", e); |
| | | } |
| | |
| | | cbo.setAttributeValue(CODE_CLASSIFY_OID_FIELD,classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | String secretValue= String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret); |
| | | cbo.setAttributeValue(SECRET_FIELD,secretValue); |
| | | }*/ |
| | | } |
| | | if(rowData.getStatus().equals(CodeDefaultLC.DISABLE.getValue())){//停用 |
| | | cbo.setLcStatus(CodeDefaultLC.DISABLE.getValue()); |
| | | }else if(rowData.getStatus().equals(CodeDefaultLC.EDITING.getValue())){//编辑 |
| | |
| | | cbo.setAttributeValue(CODE_CLASSIFY_OID_FIELD,classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | //cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | /*int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | }*/ |
| | | } |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |
| | |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | //cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | }*/ |
| | | } |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |
| | |
| | | * @param cboList 数据的列表 |
| | | * @param errorMap 错误的信息 |
| | | */ |
| | | private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap){ |
| | | private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap) throws Throwable{ |
| | | List<String> existIds = new ArrayList<>(); |
| | | String tableName =""; |
| | | try { |
| | | R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId()); |
| | | if(r.getCode()!=200) { |
| | | throw new Throwable(r.getMsg()); |
| | | } |
| | | BtmTypeVO btmTypeVO = r.getData(); |
| | | if (btmTypeVO == null) { |
| | | throw new Throwable("根据业务类型未查询到业务类型对象!"); |
| | | } |
| | | tableName = btmTypeVO.getTableName(); |
| | | if (StringUtils.isBlank(tableName)) { |
| | | throw new Throwable("根据业务类型未查询到业务类型相关联的表"); |
| | | } |
| | | }catch (Throwable e){ |
| | | throw e; |
| | | } |
| | | String finalTableName = tableName; |
| | | VciBaseUtil.switchCollectionForOracleIn(cboList).stream().forEach(cbos -> { |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])) + ")"); |
| | | |
| | | R<BtmTypeVO> r= btmTypeClient.getDetail(templateVO.getBtmTypeId()); |
| | | BtmTypeVO btmTypeVO =r.getData(); |
| | | String tableName=btmTypeVO.getTableName(); |
| | | |
| | | StringBuffer sb=new StringBuffer(); |
| | | sb.append(" select id from "); |
| | | sb.append(tableName); |
| | | sb.append(finalTableName); |
| | | sb.append(" where 1=1 "); |
| | | sb.append(" id in ("); |
| | | sb.append(" and id in ("); |
| | | sb.append(VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0]))); |
| | | sb.append(")"); |
| | | List<String> idList= commonsMapper.selectById(sb.toString()); |
| | |
| | | }else{ |
| | | if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | Map<String, String> andConditionMap = new HashMap<>(); |
| | | andConditionMap.put("islastr", "1"); |
| | | andConditionMap.put("islastv", "1"); |
| | | andConditionMap.put("lastr", "1"); |
| | | andConditionMap.put("lastv", "1"); |
| | | conditionMap.putAll(andConditionMap); |
| | | PageHelper pageHelper = new PageHelper(-1); |
| | | pageHelper.addDefaultDesc("id"); |