| | |
| | | import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.UITablePageVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.flow.core.entity.ProcessStageAttr; |
| | | import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient; |
| | | import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO; |
| | | import com.vci.ubcs.omd.constant.BtmTypeLcStatusConstant; |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.feign.*; |
| | |
| | | import com.vci.ubcs.starter.util.UBCSSqlKeyword; |
| | | import com.vci.ubcs.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.ubcs.starter.web.constant.RegExpConstant; |
| | | import com.vci.ubcs.starter.web.constant.VciSystemVarConstants; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.ubcs.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | |
| | | * 替换字符 |
| | | */ |
| | | public static final String SPECIAL_CHAR = "VCI"; |
| | | /** |
| | | * 主数据流程阶段服务 |
| | | */ |
| | | @Autowired |
| | | private IMDMIFlowAttrClient imdmiFlowAttrClient; |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper;---- |
| | | |
| | |
| | | |
| | | // baseModels.stream().forEach(model-> { |
| | | try { |
| | | map = VciBaseUtil.convertBean2Map(cbo); |
| | | map = VciBaseUtil.convertBean2Map(cbo,null); |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("类型转换错误:" + e.getMessage()); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 封装开关的内容,常用于导出 |
| | | * @param dataMap 数据的内容 |
| | | * @param templateVO 模板的显示 |
| | | */ |
| | | @Override |
| | | public void wrapperBoolean(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO){ |
| | | List<String> booleanAttributes = templateVO.getAttributes().stream().filter(s -> VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(s.getAttributeDataType())).map(s -> s.getId().toLowerCase(Locale.ROOT)).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(booleanAttributes)){ |
| | | dataMap.stream().forEach(data -> { |
| | | booleanAttributes.stream().forEach(attrId->{ |
| | | if(data.containsKey(attrId)){ |
| | | String value = data.get(attrId); |
| | | data.put(attrId,BooleanEnum.TRUE.getValue().equalsIgnoreCase(value)?"是":"否"); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) { |
| | |
| | | return uiInfoVO; |
| | | } |
| | | |
| | | /** |
| | | * 使用分类的主键获取表格的定义-ubcs后修改获取流程阶段熟悉获取方法 |
| | | * @param codeClassifyOid |
| | | * @param templateId |
| | | * @param taskId |
| | | * @param modelKey |
| | | * @return |
| | | */ |
| | | public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid,String templateId,String taskId,String modelKey) { |
| | | MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); |
| | | CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid); |
| | | uiInfoVO.setTemplateVO(templateVO); |
| | | UITableDefineVO uiTableDefineVO = wrapperTableDefineByTemplate(templateVO, true); |
| | | R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId,modelKey,taskId); |
| | | List<ProcessStageAttrVO> stageAttrVOS = r.getData(); |
| | | List<String> attrList = new ArrayList<>(); |
| | | stageAttrVOS.stream().forEach(attr->{ |
| | | attrList.add(attr.getAttrId()); |
| | | }); |
| | | uiTableDefineVO.getCols().stream().forEach(list -> { |
| | | List<UITableFieldVO> visiableTableField = new ArrayList<>(); |
| | | visiableTableField = list.stream().filter(col -> |
| | | attrList.stream().anyMatch(s -> StringUtils.equalsIgnoreCase(col.getField(), s) || |
| | | (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s)) |
| | | || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s)) |
| | | )).collect(Collectors.toList()); |
| | | |
| | | visiableTableField.stream().forEach(vo -> { |
| | | uiTableDefineVO.setHasEditor(true); |
| | | if ("refer".equalsIgnoreCase(vo.getFieldType())) { |
| | | setReferConfig2EditConfig(vo); |
| | | } else if ("combox".equalsIgnoreCase(vo.getFieldType())) { |
| | | setComboxConfig2EditConfig(vo); |
| | | } else if (StringUtils.isNotBlank(vo.getDateFormate())) { |
| | | vo.setEdit("date"); |
| | | } else { |
| | | vo.setEdit(vo.getFieldType()); |
| | | } |
| | | }); |
| | | }); |
| | | uiInfoVO.setTableDefineVO(uiTableDefineVO); |
| | | wrapperResemble(templateVO, uiInfoVO); |
| | | return uiInfoVO; |
| | | } |
| | | |
| | | /** |
| | | * 模板属性转换为表格定义的信息 |
| | | * |
| | |
| | | } |
| | | return uiInfoVO; |
| | | } |
| | | @Override |
| | | public MdmUIInfoVO getFlowUIInfoByClassifyOid(String codeClassifyOid, String functionId,String templateId,String taskId,String modelKey){ |
| | | // MdmUIInfoVO uiInfoVO = getTableDefineByClassifyOid_v2(codeClassifyOid,templateId,taskId,modelKey); |
| | | MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid)); |
| | | R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId,modelKey,taskId); |
| | | List<ProcessStageAttrVO> stageAttrVOS = r.getData(); |
| | | Set<String> attrSet = new HashSet<>(); |
| | | stageAttrVOS.stream().forEach(attr->{ |
| | | attrSet.add(attr.getAttrId()); |
| | | }); |
| | | |
| | | try { |
| | | |
| | | UITableDefineVO tableDefineVO = uiInfoVO.getTableDefineVO(); |
| | | List<List<UITableFieldVO>> tableFieldVOs = tableDefineVO.getCols(); |
| | | List<UITableFieldVO> uiTableFieldVOS = tableFieldVOs.get(0); |
| | | uiTableFieldVOS.stream().forEach(ui->{ |
| | | // if(!attrSet.contains(ui.getField())){ |
| | | // ui.setEdit(null); |
| | | // ui.setEditConfig(null); |
| | | // } |
| | | }); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("模板没有定义属性,读取表头失败!"); |
| | | } |
| | | return uiInfoVO; |
| | | } |
| | | |
| | | /** |
| | | * 使用分类主键获取工具栏中的按钮信息 |
| | |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //将bean转为map,mybatis统一处理 |
| | | //获取当前业务类型所有字段用来做对比 |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType); |
| | | if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应字段信息,请检查!"); |
| | | } |
| | | Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> { |
| | | return btmTypeAttributeVO.getId(); |
| | | }).collect(Collectors.toSet()); |
| | | //将bean转为map,mybatis统一处理 |
| | | List<Map<String, String>> maps = new ArrayList<>(); |
| | | baseModels.stream().forEach(model -> { |
| | | try { |
| | | maps.add(VciBaseUtil.convertBean2Map(model)); |
| | | maps.add(VciBaseUtil.convertBean2Map(model,existFild)); |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("类型转换错误:" + e.toString()); |
| | | } |
| | |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //获取当前业务类型所有字段用来做对比 |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType); |
| | | if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应字段信息,请检查!"); |
| | | } |
| | | Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> { |
| | | return btmTypeAttributeVO.getId(); |
| | | }).collect(Collectors.toSet()); |
| | | //将bean转为map,mybatis统一处理 |
| | | List<Map<String, String>> maps = new ArrayList<>(); |
| | | |
| | | baseModels.stream().forEach(model -> { |
| | | try { |
| | | maps.add(VciBaseUtil.convertBean2Map(model)); |
| | | maps.add(VciBaseUtil.convertBean2Map(model,existFild)); |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("类型转换错误:" + e.getMessage()); |
| | | } |