| | |
| | | import com.vci.ubcs.code.service.ICodeClassifyService; |
| | | import com.vci.ubcs.code.service.MdmEngineService; |
| | | import com.vci.ubcs.code.service.MdmIOService; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO; |
| | | import com.vci.ubcs.starter.bo.WriteExcelData; |
| | |
| | | //参照的自行输入名称 |
| | | //分类注入的不用,都是导入后自动处理的 |
| | | //编码,状态等字段不导入 |
| | | List<CodeClstempattrVO> templateAttrVOS = templateVO.getAttributes().stream().filter(s -> |
| | | List<CodeClassifyTemplateAttrVO> templateAttrVOS = templateVO.getAttributes().stream().filter(s -> |
| | | !DEFAULT_ATTR_LIST.contains(s.getId()) |
| | | && StringUtils.isBlank(s.getComponentrule()) |
| | | && StringUtils.isBlank(s.getClassifyinvokeattr()) |
| | | && (isHistory || VciBaseUtil.getBoolean(s.getFormdisplayflag())) |
| | | && StringUtils.isBlank(s.getComponentRule()) |
| | | && StringUtils.isBlank(s.getClassifyInvokeAttr()) |
| | | && (isHistory || VciBaseUtil.getBoolean(s.getFormDisplayFlag())) |
| | | ).collect(Collectors.toList()); |
| | | |
| | | if(CollectionUtils.isEmpty(templateAttrVOS)){ |
| | | throw new VciBaseException("模板没有配置任何【表单显示】为【是】的属性"); |
| | | } |
| | | List<CodeClstempattrVO> idAttrVOList = templateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList()); |
| | | List<CodeClassifyTemplateAttrVO> idAttrVOList = templateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList()); |
| | | LinkedList<WriteExcelData> excelDataList = new LinkedList<>(); |
| | | Workbook workbook = new HSSFWorkbook(); |
| | | if(isHistory){ |
| | |
| | | excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"企业编码")); |
| | | } |
| | | for (int i = 0; i < templateAttrVOS.size(); i++) { |
| | | CodeClstempattrVO attrVO = templateAttrVOS.get(i); |
| | | CodeClassifyTemplateAttrVO attrVO = templateAttrVOS.get(i); |
| | | |
| | | Object text = attrVO.getName(); |
| | | text = exportKeyAndRequired(workbook,attrVO,text); |
| | | int colIndex = (isHistory?3:0) + i; |
| | | WriteExcelData excelData = new WriteExcelData(0, colIndex, text); |
| | | if(StringUtils.isNotBlank(attrVO.getCodedateformat()) |
| | | || VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributedatatype()) |
| | | || VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributedatatype()) |
| | | ||VciFieldTypeEnum.VTTime.name().equalsIgnoreCase(attrVO.getAttributedatatype())){ |
| | | if(StringUtils.isNotBlank(attrVO.getCodeDateFormat()) |
| | | || VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributeDataType()) |
| | | || VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributeDataType()) |
| | | ||VciFieldTypeEnum.VTTime.name().equalsIgnoreCase(attrVO.getAttributeDataType())){ |
| | | excelData.setDateFormat(VciDateUtil.DateTimeFormat); |
| | | } |
| | | if(text instanceof RichTextString){ |
| | | excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); |
| | | } |
| | | excelDataList.add(excelData); |
| | | if(StringUtils.isNotBlank(attrVO.getEnumstring()) || StringUtils.isNotBlank(attrVO.getEnumid())){ |
| | | if(StringUtils.isNotBlank(attrVO.getEnumString()) || StringUtils.isNotBlank(attrVO.getEnumId())){ |
| | | //添加数据有效性 |
| | | List<String> enumValueList = new ArrayList<>(); |
| | | enumValueList.add(""); |
| | |
| | | ed.setValidationErrorMsg("请在序列中选择正确的值"); |
| | | excelDataList.add(ed); |
| | | } |
| | | if(VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())){ |
| | | if(VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())){ |
| | | List<String> booleanList = new ArrayList<>(); |
| | | |
| | | booleanList.add("是"); |
| | |
| | | * @param attrVO 属性的显示对象 |
| | | * @param text 单元格的值 |
| | | */ |
| | | private Object exportKeyAndRequired(Workbook workbook,CodeClstempattrVO attrVO,Object text){ |
| | | private Object exportKeyAndRequired(Workbook workbook,CodeClassifyTemplateAttrVO attrVO,Object text){ |
| | | //必输加*,关键属性为蓝色 |
| | | if (VciBaseUtil.getBoolean(attrVO.getRequireflag()) || VciBaseUtil.getBoolean(attrVO.getKeyattrflag())) { |
| | | if (VciBaseUtil.getBoolean(attrVO.getRequireFlag()) || VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())) { |
| | | String value = text.toString(); |
| | | if(VciBaseUtil.getBoolean(attrVO.getRequireflag())) { |
| | | if(VciBaseUtil.getBoolean(attrVO.getRequireFlag())) { |
| | | value += REQUIRED_CHAR; |
| | | } |
| | | if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){ |
| | | if(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())){ |
| | | value += KEY_ATTR_CHAR; |
| | | } |
| | | RichTextString ts = new HSSFRichTextString(value); |
| | | if(VciBaseUtil.getBoolean(attrVO.getRequireflag())){ |
| | | if(VciBaseUtil.getBoolean(attrVO.getRequireFlag())){ |
| | | Font font = workbook.createFont(); |
| | | font.setColor(HSSFColor.HSSFColorPredefined.RED.getIndex()); |
| | | ts.applyFont(font); |
| | | } |
| | | |
| | | if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){ |
| | | if(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())){ |
| | | Font font = workbook.createFont(); |
| | | font.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); |
| | | ts.applyFont(font); |