| | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public class CodeApplyFor410MainPanel extends VCIJPanel { |
| | | |
| | |
| | | private RMDataTransmitObject transmitForRMData = null; |
| | | private CodeRuleVO codeRuleVO=null; |
| | | /** |
| | | * 存储属性和值的Map,key,用于默认值的显示 |
| | | */ |
| | | private Map<String,String> displayValues = new HashMap<>(); |
| | | /** |
| | | * 属性ID与属性对应的控件之间的映射MAP |
| | | */ |
| | | private LinkedHashMap<String, JComponent> attrIdToCtrlMaps = new LinkedHashMap<String, JComponent>(); |
| | |
| | | this.currentCodeClassifyTemplateVO=currentCodeClassifyTemplateVO; |
| | | } |
| | | |
| | | public CodeApplyFor410MainPanel(TransmitTreeObject transTreeObject,TokenUserObject tokenUserObject,String deptName,CodeClassifyTemplateVO currentCodeClassifyTemplateVO) { |
| | | public CodeApplyFor410MainPanel(TransmitTreeObject transTreeObject,TokenUserObject tokenUserObject,String deptName,CodeClassifyTemplateVO currentCodeClassifyTemplateVO,Map displayValues) { |
| | | this.transTreeObject = transTreeObject; |
| | | this.tokenUserObject = tokenUserObject; |
| | | this.deptName = deptName; |
| | | this.currentCodeClassifyTemplateVO=currentCodeClassifyTemplateVO; |
| | | this.displayValues = displayValues; |
| | | } |
| | | |
| | | /** |
| | |
| | | if(codeClassifyValueList.size()>1) { |
| | | secCombo.addItem(new CodeClassifyValue()); |
| | | } |
| | | codeClassifyValueList.stream().forEach(codeClassifyValue -> { |
| | | for (CodeClassifyValue codeClassifyValue : codeClassifyValueList) { |
| | | secCombo.addItem(codeClassifyValue); |
| | | valueOidList.add(codeClassifyValue.getOid()); |
| | | }); |
| | | } |
| | | } |
| | | secIdTOListValueOidMap.put(secObj.getOid(),valueOidList); |
| | | /**代码项下拉事件**/ |
| | |
| | | if(fixedValueVOList.size() >1) { |
| | | secCombo.addItem(new CodeFixedValue()); |
| | | } |
| | | fixedValueVOList.stream().forEach(codeFixedValueVO -> { |
| | | for (CodeFixedValueVO codeFixedValueVO : fixedValueVOList) { |
| | | CodeFixedValue codeFixedValue=new CodeFixedValue(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeFixedValueVO,codeFixedValue); |
| | | secCombo.addItem(codeFixedValue); |
| | | }); |
| | | } |
| | | /**当系统选择的是指定码段值时,组别代号的码段系统不显示 Begin**/ |
| | | /*FixCodeValObject selObj = (FixCodeValObject) secCombo.getSelectedItem(); |
| | | if(isSpecialRuleFlag && (secObj.getName().equals(specialControlSecName) && secValMap.containsKey(selObj.getValue())) || secValMap.containsKey(getControlSecSelectValue())) { |
| | |
| | | transmit.setRmTypeObject(codeClassify); |
| | | if(currentCodeClassifyTemplateVO!=null) { |
| | | transmit.setTemplateId(templateId); |
| | | Map<String, CodeClassifyTemplateAttrVO> tempPropObjMapsByInnerName = currentCodeClassifyTemplateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | Map<String, CodeClassifyTemplateAttrVO> tempPropObjMapsByInnerName = new HashMap<>(); |
| | | for (CodeClassifyTemplateAttrVO attribute : currentCodeClassifyTemplateVO.getAttributes()) { |
| | | tempPropObjMapsByInnerName.put(attribute.getId().toLowerCase(Locale.ROOT),attribute); |
| | | } |
| | | transmit.setClassifyCode(codeClassify.getId()); |
| | | transmit.setTempPropObjMapsByInnerName(tempPropObjMapsByInnerName); |
| | | Map<String, CodeClassifyTemplateAttrVO> tempPropObjsMap = currentCodeClassifyTemplateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getOid().toLowerCase(Locale.ROOT), t -> t)); |
| | | Map<String, CodeClassifyTemplateAttrVO> tempPropObjsMap = new HashMap<>(); |
| | | for (CodeClassifyTemplateAttrVO attribute : currentCodeClassifyTemplateVO.getAttributes()) { |
| | | tempPropObjsMap.put(attribute.getOid().toLowerCase(Locale.ROOT),attribute); |
| | | } |
| | | transmit.setTempPropObjsMap(tempPropObjsMap); |
| | | transmit.setTemplateObject(currentCodeClassifyTemplateVO); |
| | | transmit.setTempPropObjsList(this.currentCodeClassifyTemplateVO.getAttributes()); |
| | |
| | | if (index >= realAttrs.length) { |
| | | break; |
| | | } |
| | | CodeClassifyTemplateAttrVO attrObj = realAttrs[index]; |
| | | final CodeClassifyTemplateAttrVO attrObj = realAttrs[index]; |
| | | |
| | | /***如果模板配置了引用模板,属性名称列表添加链接进行处理 BEGIN**/ |
| | | //ADD BY liujw |
| | |
| | | for (int i = 0; i < objs.length; i++) { |
| | | objs[i] = new AttrRangObjectWarper(keyValues[i]); |
| | | model.addElement(objs[i]); |
| | | |
| | | specMap.put(objs[i].toString(), comboBoxIndex++); |
| | | } |
| | | cbx.setModel(model); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | // cbx.setSelectedItem(displayValues.get(attrObj.getId())); |
| | | // cbx.setSelectedIndex(3); |
| | | for (int i = 0; i < objs.length; i++) { |
| | | if(objs[i].getKeyValue().getKey().equals(displayValues.get(attrObj.getId()))){ |
| | | cbx.setSelectedIndex(i); |
| | | } |
| | | } |
| | | cbx.setEnabled(false); |
| | | } |
| | | compt = cbx; |
| | | } |
| | | } else if(StringUtils.isNotBlank(attrObj.getReferConfig())){//参照的需要设置成下拉框,并且只读 |
| | |
| | | cbx.setModel(model); |
| | | compt = cbx; |
| | | } else { // 不存在取值范围则按类型生成不同的控件 |
| | | if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTBoolean)) { // Boolean类型 |
| | | if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTBoolean.toString())) { // Boolean类型 |
| | | VCIJComboBox cbx = new VCIJComboBox(); |
| | | DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | model.addElement("0"); |
| | | model.addElement("1"); |
| | | cbx.setModel(model); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | cbx.setSelectedIndex(Integer.parseInt(displayValues.get(attrObj.getId()))); |
| | | cbx.setEnabled(false); |
| | | return cbx; |
| | | } |
| | | compt = cbx; |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDate)) { // 日期类型 |
| | | compt = new VCIJCalendarPanel("yyyy-MM-dd", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDateTime)) { // 日期类型 |
| | | compt = new VCIJCalendarPanel("yyyy-MM-dd HH:mm:ss", |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDate.toString())) { // 日期类型 |
| | | VCIJCalendarPanel aTrue = new VCIJCalendarPanel("yyyy-MM-dd", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | }else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTTime)) { // 日期类型 |
| | | compt = new VCIJCalendarPanel("HH:mm:ss", |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | aTrue.setDateString(displayValues.get(attrObj.getId())); |
| | | aTrue.setEnabled(false); |
| | | return aTrue; |
| | | } |
| | | compt = aTrue; |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDateTime.toString())) { // 日期类型 |
| | | VCIJCalendarPanel aTrue = new VCIJCalendarPanel("yyyy-MM-dd HH:mm:ss", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | aTrue.setDateString(displayValues.get(attrObj.getId())); |
| | | aTrue.setEnabled(false); |
| | | return aTrue; |
| | | } |
| | | compt = aTrue; |
| | | }else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTTime.toString())) { // 日期类型 |
| | | VCIJCalendarPanel aTrue = new VCIJCalendarPanel("HH:mm:ss", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | aTrue.setDateString(displayValues.get(attrObj.getId())); |
| | | aTrue.setEnabled(false); |
| | | return aTrue; |
| | | } |
| | | compt = aTrue; |
| | | } |
| | | else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDouble)||attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTLong)) { // Real类型 |
| | | else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDouble.toString())||attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTLong.toString())) { // Real类型 |
| | | RealTextField txt = new RealTextField(""); |
| | | txt.setRequired(attrObj.getRequireFlag().equals("true")); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | txt.setText(displayValues.get(attrObj.getId())); |
| | | txt.setEditable(false); |
| | | } |
| | | compt = txt; |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTInteger)) { // Integer类型 |
| | | } else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTInteger.toString())) { // Integer类型 |
| | | IntegerTextField txt = new IntegerTextField(""); |
| | | txt.setRequired(attrObj.getRequireFlag().equals("true")); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | txt.setText(displayValues.get(attrObj.getId())); |
| | | txt.setEditable(false); |
| | | } |
| | | compt = txt; |
| | | } |
| | | else{ |
| | | VCIJTextField txt = new VCIJTextField(this,attrObj.getRequireFlag().equals("true")); |
| | | if(displayValues.containsKey(attrObj.getId())){ |
| | | txt.setText(displayValues.get(attrObj.getId())); |
| | | txt.setEditable(false); |
| | | } |
| | | compt = txt; |
| | | textCompts.add(txt); |
| | | } |
| | |
| | | private void getComptAttrValue( CodeClassifyTemplateAttrVO tempPropObj, LinkedHashMap<String, JComponent> attrIdToCtrlMaps) { |
| | | Map<String,String> dataMap=new HashMap<>(); |
| | | Map<String,String> condtionMap=new HashMap<>(); |
| | | attrIdToCtrlMaps.forEach((key,compt)->{ |
| | | for(String key: attrIdToCtrlMaps.keySet()){ |
| | | JComponent compt = attrIdToCtrlMaps.get(key); |
| | | String value = ""; |
| | | if (compt instanceof JTextComponent) { |
| | | value = ((JTextComponent) compt).getText(); |
| | |
| | | } |
| | | dataMap.put(key,value); |
| | | condtionMap.put("dataMap["+key+"]",value); |
| | | }); |
| | | } |
| | | condtionMap.put("componentRuleValue",tempPropObj.getComponentRule()); |
| | | Map<String,String> headerMap=new HashMap<>(); |
| | | headerMap.put("Blade-Auth",this.tokenUserObject.getAccess_token()); |
| | |
| | | dialog.setVisible(true); |
| | | } |
| | | |
| | | private void doSearch(VCIJComboxBox comboxBox,CodeBasicSecVO secObj){ |
| | | private void doSearch(final VCIJComboxBox comboxBox, CodeBasicSecVO secObj){ |
| | | if(StringUtils.isBlank(secObj.getReferConfig())){ |
| | | VCIOptionPane.showMessage(this,"参照配置信息不正确,请核对!"); |
| | | return; |
| | |
| | | LinkedList<String> listValues = new LinkedList<String>(); |
| | | // 各属性的类型 |
| | | LinkedList<String> listDataTypes = new LinkedList<String>(); |
| | | Map<String,CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOMap=transmitForRMData.getTempPropObjsList().stream().collect(Collectors.toMap(s -> s.getId(), t -> t)); |
| | | Map<String,CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOMap = new HashMap<>(); |
| | | for (CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO : transmitForRMData.getTempPropObjsList()) { |
| | | codeClassifyTemplateAttrVOMap.put(codeClassifyTemplateAttrVO.getId(),codeClassifyTemplateAttrVO); |
| | | } |
| | | Iterator<String> keys = attrIdToCtrlMaps.keySet().iterator(); |
| | | JComponent compt = null; |
| | | JComponent firstCompt = null; |