| | |
| | | package com.vci.rmip.code.client.codeapply.Apply410; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.vci.base.ui.swing.VCIOptionPane; |
| | | import com.vci.base.ui.swing.components.*; |
| | | import com.vci.base.ui.tree.VCIBaseTreeNode; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.enums.VciFieldTypeEnum; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.*; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.vo.CodeBasicSecVO; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.vo.CodeClassifyTemplateAttrVO; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.vo.CodeFixedValueVO; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.vo.CodeRuleVO; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.object.ubcscode.vo.KeyValue; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.swing.IntegerTextField; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.swing.RealTextField; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.swing.VCIJComboxBox; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.BeanUtilForVCI; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.ConfigUtils; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.HttpUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.KeyValue; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.VciBaseUtil; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.codehaus.jackson.JsonProcessingException; |
| | | import org.codehaus.jackson.map.ObjectMapper; |
| | | import org.codehaus.jackson.type.TypeReference; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.text.JTextComponent; |
| | |
| | | import java.awt.event.ActionListener; |
| | | import java.awt.event.MouseAdapter; |
| | | import java.awt.event.MouseEvent; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public class CodeApplyFor410MainPanel extends VCIJPanel { |
| | | |
| | |
| | | private final String SPECIAL_SECTION_NAME = "Special.section.name"; |
| | | private final String SPECIAL_CONTROL_SECTION_NAME = "Special.control.other.section.name"; |
| | | private final String SPECIAL_SECTION_VALUE = "Special.section.val"; |
| | | |
| | | |
| | | Map<String, CodeBasicSecVO> secMap = new LinkedHashMap<String, CodeBasicSecVO>(); |
| | | Map<String, VCIJComboxBox> comMap = new LinkedHashMap<String, VCIJComboxBox>(); |
| | | Map<String, Integer> secPositionMap = new LinkedHashMap<String, Integer>(); |
| | | |
| | | private final String MAX_ATTR_IN_LINE_KEY = "RMData.MaxAttrInLine"; |
| | | private final String TEXTAREA_ENABLE_KEY = "RMData.TextArea.Enable"; |
| | |
| | | private StringBuffer tempStr= new StringBuffer();//可变码段的值; |
| | | private String levelRes=""; |
| | | private String[] specialSecVals = new String[0]; |
| | | private RMDataTransmitObject transmitForRMData = null; |
| | | private RMDataTransmitObject transmitForRMData = new RMDataTransmitObject(); |
| | | private CodeRuleVO codeRuleVO=null; |
| | | /** |
| | | * 存储属性和值的Map,key,用于默认值的显示 |
| | | */ |
| | | private Map<String,String> displayValues = new HashMap<>(); |
| | | /** |
| | | * 属性ID与属性对应的控件之间的映射MAP |
| | | */ |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | codeRuleVO = objectMapper.readValue(object.toString(),CodeRuleVO.class); |
| | | } catch (JsonProcessingException e) { |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | VCIOptionPane.showMessage(this,r.getMsg()); |
| | | /* if(!r.getMsg().equals("当前主题库分类,以及它的所有的上级分类都没有设置编码规则")){ |
| | | VCIOptionPane.showMessage(this,r.getMsg()); |
| | | }*/ |
| | | } |
| | | /**加载规则对应的码段信息**/ |
| | | if(codeRuleVO!=null){ |
| | |
| | | String classifyLevel = tempPropObj.getClassifyInvokeLevel(); |
| | | String classifyInvokeAttr= tempPropObj.getClassifyInvokeAttr(); |
| | | JComponent compt = attrInnerNameToCtrlMaps.get(innerName); |
| | | if(StringUtils.isNotBlank(classifyLevel)&&!classifyLevel.equals("none")&&!classifyLevel.equals("min")) { |
| | | if(StringUtils.isNotBlank(classifyLevel)&&!classifyLevel.equals("none")) { |
| | | compt.setEnabled(false); |
| | | //ClassifyLevel classifyLevelObj=new ClassifyLevel(); |
| | | //ObjectMapper objectMapper = new ObjectMapper(); |
| | |
| | | * @param secObjs |
| | | */ |
| | | public void initCurrentRow(CodeBasicSecVO[] secObjs,VCIJComboxBox[] secCombos) { |
| | | SectionObject lastSecObj = null; |
| | | CodeBasicSecVO lastSecObj = null; |
| | | VCIJComboxBox hisCombo = null; |
| | | try { |
| | | final Map<String, String> secValMap = getSpecialValMap(specialSecVals); |
| | | final Map<String, String> sOecValMap = getSpecialValMap(specialSecVals); |
| | | Map<String,List<String>> secIdTOListValueOidMap=new HashMap<>(); |
| | | for(int k = 0;k < secObjs.length; k++) { |
| | | final CodeBasicSecVO secObj = secObjs[k]; |
| | |
| | | if (secObj.getSecType().equals("codeclassifysec")) {// 是分类码 |
| | | String secOid=secObj.getOid(); |
| | | String parentClassifySecOid= secObj.getParentClassifySecOid(); |
| | | |
| | | if(lastSecObj != null) { |
| | | lastSecObj = secMap.get(secObj.getParentClassifySecOid()); |
| | | hisCombo = comMap.get(secObj.getParentClassifySecOid()); |
| | | } |
| | | |
| | | if(lastSecObj != null && lastSecObj.getSecType().equals("codeclassifysec") |
| | | && secObj.getParentClassifySecOid().equals(lastSecObj.getOid())) { |
| | | |
| | | hisCombo.addActionListener(new NextComboAction(secPositionMap.get(secObj.getParentClassifySecOid()), comMap.get(secObj.getParentClassifySecOid()),secCombos)); |
| | | initNextCombo(k,secCombo,(CodeClassifyValue)comMap.get(secObj.getParentClassifySecOid()).getSelectedItem(),secPositionMap.get(secObj.getParentClassifySecOid()),secCombos); |
| | | |
| | | //多级分类码段码值加载错误的Bug修复 |
| | | lastSecObj = secObj; |
| | | hisCombo = secCombo; |
| | | |
| | | secMap.put(secObj.getOid(), secObj); |
| | | comMap.put(secObj.getOid(), secCombo); |
| | | secPositionMap.put(secObj.getOid(),k); |
| | | continue; |
| | | |
| | | } |
| | | |
| | | String parentClassifyValueOid=""; |
| | | if(secIdTOListValueOidMap.containsKey(parentClassifySecOid)){ |
| | | List<String> parentClassifyValueList= secIdTOListValueOidMap.get(parentClassifySecOid); |
| | |
| | | if(object!=null) { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | codeClassifyValueList = objectMapper.readValue(object.toString(), new com.fasterxml.jackson.core.type.TypeReference<List<CodeClassifyValue>>() {}); |
| | | codeClassifyValueList = objectMapper.readValue(object.toString(), new TypeReference<List<CodeClassifyValue>>() {}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | 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); |
| | | lastSecObj = secObj; |
| | | hisCombo = secCombo; |
| | | |
| | | secMap.put(secObj.getOid(), secObj); |
| | | comMap.put(secObj.getOid(), secCombo); |
| | | secPositionMap.put(secObj.getOid(),k); |
| | | /**代码项下拉事件**/ |
| | | secCombo.addActionListener(new ActionListener() { |
| | | public void actionPerformed(ActionEvent e) { |
| | |
| | | // 是固定码 |
| | | if (secObj.getSecType() .equals("codefixedsec")) { |
| | | List<CodeFixedValueVO> fixedValueVOList=secObj.getFixedValueVOList(); |
| | | //如果只有一个值,则系统默认选择,不加空值 |
| | | if(fixedValueVOList.size() >1) { |
| | | secCombo.addItem(new CodeFixedValue()); |
| | | } |
| | | fixedValueVOList.stream().forEach(codeFixedValueVO -> { |
| | | CodeFixedValue codeFixedValue=new CodeFixedValue(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeFixedValueVO,codeFixedValue); |
| | | secCombo.addItem(codeFixedValue); |
| | | }); |
| | | /**当系统选择的是指定码段值时,组别代号的码段系统不显示 Begin**/ |
| | | //如果只有一个值,则系统默认选择,不加空值 |
| | | if(fixedValueVOList.size() >1) { |
| | | secCombo.addItem(new CodeFixedValue()); |
| | | } |
| | | 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())) { |
| | | setComponentStatus(false); |
| | |
| | | secCombo.setFlag(false); |
| | | secCombo.getSearchBtn().setVisible(false); |
| | | }*/ |
| | | } else |
| | | } else |
| | | // 是日期码段 |
| | | if (secObj.getSecType().equals("codedatesec")) { |
| | | String df =secObj.getCodeDateFormatStr(); |
| | | SimpleDateFormat dateFormate = new SimpleDateFormat(df); |
| | | String curDate = dateFormate.format(Calendar.getInstance().getTime()); |
| | | secCombo.addItem(curDate); |
| | | if (secObj.getSecType().equals("codedatesec")) { |
| | | String df =secObj.getCodeDateFormatStr(); |
| | | SimpleDateFormat dateFormate = new SimpleDateFormat(df); |
| | | String curDate = dateFormate.format(Calendar.getInstance().getTime()); |
| | | secCombo.addItem(curDate); |
| | | /*if(dateObj.getIsModify().equals("Y")){//可以修改 |
| | | secCombo.setEditable(true); |
| | | }*/ |
| | | } else |
| | | //是引用码段 |
| | | if (secObj.getSecType().equals("coderefersec")) { |
| | | } else |
| | | //是引用码段 |
| | | if (secObj.getSecType().equals("coderefersec")) { |
| | | |
| | | if (!secCombo.isFlag()){ |
| | | secCombo.setFlag(true); |
| | | secCombo.getSearchBtn().setVisible(true); |
| | | secCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(secCombo,secObj); |
| | | if (!secCombo.isFlag()){ |
| | | secCombo.setFlag(true); |
| | | secCombo.getSearchBtn().setVisible(true); |
| | | secCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(secCombo,secObj); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /*RefSecObject refObj = getRefSecObj(secObj.getId()); |
| | | DefaultComboBoxModel aModel = getRefSecComboBox(refObj); |
| | | secCombo.setModel(aModel); |
| | |
| | | } |
| | | |
| | | */} else |
| | | //层级码段码值显示的是选择的代码项的名称 |
| | | if(secObj.getSecType().equals("codelevelsec")) { |
| | | CodeClassify rmObj = (CodeClassify) this.transTreeObject.getCurrentTreeNode().getObj(); |
| | | secCombo.addItem(rmObj); |
| | | } else { |
| | | secCombo.setEditable(true); |
| | | } |
| | | //层级码段码值显示的是选择的代码项的名称 |
| | | if(secObj.getSecType().equals("codelevelsec")) { |
| | | CodeClassify rmObj = (CodeClassify) this.transTreeObject.getCurrentTreeNode().getObj(); |
| | | secCombo.addItem(rmObj); |
| | | } else { |
| | | secCombo.setEditable(true); |
| | | } |
| | | } |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | 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 |
| | |
| | | lbl.setToolTipText("点击此处获取模板对应规则的值"); |
| | | lbl.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e){ |
| | | getComptAttrValue(attrObj,attrIdToCtrlMaps); |
| | | getComptAttrValue(attrObj,attrIdToCtrlMaps); |
| | | |
| | | } |
| | | }); |
| | |
| | | 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", |
| | | } 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.VTDateTime)) { // 日期类型 |
| | | compt = new VCIJCalendarPanel("yyyy-MM-dd HH:mm:ss", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | }else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTTime)) { // 日期类型 |
| | | compt = new VCIJCalendarPanel("HH:mm:ss", |
| | | attrObj.getRequireFlag().equals("true"), true, false); |
| | | } |
| | | else if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDouble)||attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTLong)) { // Real类型 |
| | | 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.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")); |
| | | compt = txt; |
| | | textCompts.add(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); |
| | | } |
| | | boolean enabled = true; |
| | | |
| | | /*// 集团代码、集团附加码不可以手工录入数据 |
| | | if (attrObj.getId().equals(Constants.GROUP_CODE_INNERNAME)|| attrObj.getInternalname().equals(Constants.GROUP_ADD_CODE_INNERNAME)) { |
| | | // 集团代码、集团附加码不可以手工录入数据 |
| | | if (attrObj.getId().toLowerCase().equals("groupcode")) { |
| | | enabled = false; |
| | | }*/ |
| | | } |
| | | |
| | | compt.setEnabled(enabled); |
| | | } |
| | | |
| | | return compt; |
| | | } |
| | | /** |
| | | * 处理下拉框的事件 |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | class NextComboAction implements ActionListener { |
| | | private int column = 0; |
| | | private VCIJComboxBox curCombo = null; |
| | | private VCIJComboxBox[] secCombos = null; |
| | | |
| | | public NextComboAction(int column,VCIJComboxBox curCombo,VCIJComboxBox[] secCombos) { |
| | | this.column = column; |
| | | this.curCombo = curCombo; |
| | | this.secCombos = secCombos; |
| | | } |
| | | |
| | | public void actionPerformed(ActionEvent e) { |
| | | VCIJComboxBox nextCombo = secCombos[column+1]; |
| | | if(curCombo.getSelectedIndex() != -1){ |
| | | CodeClassifyValue obj = (CodeClassifyValue)curCombo.getSelectedItem(); |
| | | initNextCombo(column+1, nextCombo, obj, column,secCombos); |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 初始化下一个下拉列表 |
| | | * @param column |
| | | * @param curCombo |
| | | * @param lastObj 上一个选中的分类码段码值的对象(只针对分类码) |
| | | */ |
| | | public void initNextCombo(int column,VCIJComboxBox curCombo,CodeClassifyValue lastObj,int lastColumn,VCIJComboxBox[] secCombos) { |
| | | |
| | | final VCIJComboxBox nextCombo = curCombo; |
| | | CodeBasicSecVO lastSecObj = columnSecMap.get(lastColumn); |
| | | final CodeBasicSecVO nextSecObj = columnSecMap.get(column); |
| | | |
| | | if(nextSecObj == null) {//如果后面没有对象,则返回 |
| | | return; |
| | | } |
| | | |
| | | boolean isContinue = false; |
| | | if(nextSecObj.getSecType().equals("codeclassifysec")){//如果当前是分类码 |
| | | CodeBasicSecVO curObj =nextSecObj; |
| | | if(lastSecObj.getSecType().equals("codeclassifysec") |
| | | && curObj.getParentClassifySecOid().equals(lastSecObj.getOid())){ |
| | | isContinue = true; |
| | | } |
| | | } |
| | | if(lastObj == null || !isContinue){//如果当前列的下拉框已经初始过,并且上一分类码不是当前分类码的父 |
| | | return; |
| | | } |
| | | VCIJComboxBox lastColumnComboxBox= secCombos[lastColumn]; |
| | | |
| | | if(nextSecObj.getSecType().equals("codeclassifysec")){//分类码 |
| | | CodeClassifyValue[] clsfCodeVals = new CodeClassifyValue[]{}; |
| | | //如果上一个是分类码,并且是当前分类码的父 |
| | | /*if (isContinue) { |
| | | clsfCodeVals = clsfCodeValDel.getChildClsfCodeVal(lastObj.getOid()); |
| | | } else { |
| | | clsfCodeVals = clsfCodeValDel.getSecRootClsfCodeVal(nextSecObj.getOid());//获取该码段下的所有码段码值对象 |
| | | }*/ |
| | | String parentClassifyValueOid=""; |
| | | if(lastColumnComboxBox!=null){ |
| | | CodeClassifyValue selectedItem = (CodeClassifyValue)lastColumnComboxBox.getSelectedItem(); |
| | | if(selectedItem!=null) |
| | | parentClassifyValueOid= selectedItem.getOid(); |
| | | |
| | | } |
| | | Map<String,String> condtionMap=new HashMap<>(); |
| | | condtionMap.put("secOid", nextSecObj.getOid()); |
| | | condtionMap.put("parentClassifyValueOid",parentClassifyValueOid); |
| | | Map<String,String> headerMap=new HashMap<>(); |
| | | headerMap.put("Blade-Auth",this.tokenUserObject.getAccess_token()); |
| | | R r=HttpUtil.sendGet(url+"/listCodeClassifyValueBySecOid",condtionMap,headerMap); |
| | | List<CodeClassifyValue> codeClassifyValueList=new ArrayList<>(); |
| | | if(r.isSuccess()){ |
| | | Object object= r.getData(); |
| | | if(object!=null) { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | codeClassifyValueList = objectMapper.readValue(object.toString(), new TypeReference<List<CodeClassifyValue>>() {}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | VCIOptionPane.showMessage(this,r.getMsg()); |
| | | } |
| | | |
| | | DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | for(int i = 0;i< codeClassifyValueList.size();i++) { |
| | | /*if(!codeClassifyValueList.get(i).getOid().equals(nextSecObj.getOid())) { |
| | | continue; |
| | | }*/ |
| | | model.addElement(codeClassifyValueList.get(i)); |
| | | } |
| | | |
| | | /*Map<String, String> secValMap = getSpecialValMap(specialSecVals); |
| | | if(isSpecialRuleFlag && (lastSecObj.getName().equals(specialControlSecName) && secValMap.containsKey(lastObj.getValue())) || secValMap.containsKey(getControlSecSelectValue())) { |
| | | setComponentStatus(false); |
| | | }else { |
| | | setComponentStatus(true); |
| | | }*/ |
| | | /******************END************************/ |
| | | |
| | | nextCombo.setModel(model); |
| | | nextCombo.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent arg0) { |
| | | ((VCIJTextField)secIdToClsfIdMap.get(nextSecObj.getId())).setText(((CodeClassifyValue)nextCombo.getSelectedItem()).getName()); |
| | | } |
| | | }); |
| | | |
| | | if(nextCombo.getSelectedItem() != null) { |
| | | ((VCIJTextField)secIdToClsfIdMap.get(lastSecObj.getId())).setText(lastObj.getName()); |
| | | ((VCIJTextField)secIdToClsfIdMap.get(nextSecObj.getId())).setText(((CodeClassifyValue)nextCombo.getSelectedItem()).getName()); |
| | | } |
| | | |
| | | //修复选择分类码段码值后,所有的子分类的码段码值不能更新的问题 |
| | | int k = column + 1; |
| | | if(k < columnSecMap.size() && columnSecMap.get(k).getSecType().equals("codeclassifysec")) { |
| | | CodeBasicSecVO currentSecObj = columnSecMap.get(k); |
| | | // SortSecObject curObj = new SectionClientDelegate(userObj).fetchSortSecById(currentSecObj.getId()); |
| | | if (secPositionMap.get(currentSecObj.getParentClassifySecOid()) != null) { |
| | | // secCombos[column].addActionListener(new NextComboAction(secPositionMap.get(curObj.getId()), comMap.get(curObj.getId()),secCombos)); |
| | | CodeClassifyValue nextClsfCodeValObj = (CodeClassifyValue)comMap.get(currentSecObj.getParentClassifySecOid()).getSelectedItem() == null ? new CodeClassifyValue():(CodeClassifyValue)comMap.get(currentSecObj.getParentClassifySecOid()).getSelectedItem(); |
| | | initNextCombo(k,secCombos[k],nextClsfCodeValObj,secPositionMap.get(currentSecObj.getParentClassifySecOid()),secCombos); |
| | | } |
| | | // k++; |
| | | } |
| | | /*if (nextCombo.getItemCount() > 10){ |
| | | if (!nextCombo.isFlag()){ |
| | | nextCombo.setFlag(true); |
| | | nextCombo.getSearchBtn().setVisible(true); |
| | | nextCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(nextCombo); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }else { |
| | | nextCombo.setFlag(false); |
| | | nextCombo.getSearchBtn().setVisible(false); |
| | | }*/ |
| | | }else if(nextSecObj.getSecType().equals("codefixedsec")){//固定码 |
| | | Map<String, String> secValMap = getSpecialValMap(specialSecVals); |
| | | /*if(isSpecialRuleFlag && (lastSecObj.getName().equals(specialControlSecName) && secValMap.containsKey(lastObj.getValue())) || secValMap.containsKey(getControlSecSelectValue())) { |
| | | setComponentStatus(false); |
| | | }else { |
| | | setComponentStatus(true); |
| | | }*/ |
| | | /******************END************************/ |
| | | |
| | | // SectionValueClientDelegate codeValDel = new SectionValueClientDelegate(userObj); |
| | | //FixCodeValObject[] codeValObjs = codeValDel.fetchFixCodeValBySecId(nextSecObj.getId());//获取该码段下的所有码段码值对象 |
| | | List<CodeFixedValueVO> fixedValueVOList=nextSecObj.getFixedValueVOList(); |
| | | for(int i = 0;i< fixedValueVOList.size();i++) { |
| | | nextCombo.addItem(fixedValueVOList.get(i)); |
| | | } |
| | | /*if (nextCombo.getItemCount() > 10){ |
| | | if (!nextCombo.isFlag()){ |
| | | nextCombo.setFlag(true); |
| | | nextCombo.getSearchBtn().setVisible(true); |
| | | nextCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(nextCombo); |
| | | } |
| | | }); |
| | | } |
| | | }else { |
| | | nextCombo.setFlag(false); |
| | | nextCombo.getSearchBtn().setVisible(false); |
| | | }*/ |
| | | }else if(nextSecObj.getSecType().equals("codedatesec")){//日期码段 |
| | | // DateSecObject dateObj = secDel.fetchDateSecById(nextSecObj.getId()); |
| | | |
| | | String df =nextSecObj.getCodeDateFormatStr(); |
| | | String CodeDateValue= nextSecObj.getCodeDateValue(); |
| | | SimpleDateFormat dateFormate = new SimpleDateFormat(df); |
| | | if(StringUtils.isBlank(CodeDateValue)){ |
| | | CodeDateValue= dateFormate.format(Calendar.getInstance().getTime()); |
| | | } |
| | | nextCombo.addItem(CodeDateValue); |
| | | /*if(dateObj.getIsModify().equals("Y")){ |
| | | nextCombo.setEditable(true); |
| | | }*/ |
| | | }/*else if(nextSecObj.getSecType() equals("")){//分隔符 |
| | | nextCombo.addItem(nextSecObj.getId());}*/ |
| | | else if (nextSecObj.getSecType().equals("coderefersec")) { |
| | | if (!nextCombo.isFlag()){ |
| | | nextCombo.setFlag(true); |
| | | nextCombo.getSearchBtn().setVisible(true); |
| | | nextCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(nextCombo,nextSecObj); |
| | | } |
| | | }); |
| | | } |
| | | }else { |
| | | nextCombo.setEditable(true); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /**** |
| | | * 根据属性id获取属性取值范围的值 |
| | | * <p>Description: </p> |
| | |
| | | if(object!=null) { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | keyValueList = objectMapper.readValue(object.toString(), new com.fasterxml.jackson.core.type.TypeReference<List<KeyValue>>() { |
| | | keyValueList = objectMapper.readValue(object.toString(), new TypeReference<List<KeyValue>>() { |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | |
| | | 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()); |
| | |
| | | VCIOptionPane.showMessage(this,r.getMsg()); |
| | | } |
| | | } |
| | | /** |
| | | * 根据引用模板的id获取引用模板对象包含的数据 |
| | | * <p>Description: </p> |
| | | * |
| | | * @author liujw |
| | | * @time 2012-11-29 |
| | | * @param //referTempId 引用模板id |
| | | */ |
| | | /** |
| | | * 根据引用模板的id获取引用模板对象包含的数据 |
| | | * <p>Description: </p> |
| | | * |
| | | * @author liujw |
| | | * @time 2012-11-29 |
| | | * @param //referTempId 引用模板id |
| | | */ |
| | | private void getReferTempRMData(final CodeClassifyTemplateAttrVO tempPropObj,final LinkedHashMap<String, JComponent> attrIdToCtrlMaps, |
| | | final List<CodeClassifyTemplateAttrVO> tempPropList) { |
| | | // 本空窗口调用 有可能来自两处 |
| | |
| | | }*/ |
| | | keyValue= dialog.getKeyValue(); |
| | | //for(CodeClassifyTemplateAttrVO obj : tempPropList) { |
| | | if(attrIdToCtrlMaps.containsKey(tempPropObj.getId())) { |
| | | JComponent comp = attrIdToCtrlMaps.get(tempPropObj.getId()); |
| | | if(attrIdToCtrlMaps.containsKey(tempPropObj.getId())) { |
| | | JComponent comp = attrIdToCtrlMaps.get(tempPropObj.getId()); |
| | | /*if(comp instanceof VCIJTextField) { |
| | | int index = innnerNamesMaps.get(tempPropObj.getInternalname()); |
| | | ((VCIJTextField) comp).setText(datas[index]); |
| | |
| | | int index = innnerNamesMaps.get(tempPropObj.getInternalname()); |
| | | ((VCIJCalendarPanel) comp).setDateString(datas[index]); |
| | | } else */ |
| | | if (comp instanceof VCIJComboBox) { |
| | | //DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | if(keyValue!=null) { |
| | | AttrRangObjectWarper wrapper = new AttrRangObjectWarper(keyValue); |
| | | ((VCIJComboBox) comp).getModel().setSelectedItem(wrapper); |
| | | } |
| | | //model.addElement(wrapper); |
| | | //((VCIJComboBox) comp).setModel(model); |
| | | if (comp instanceof VCIJComboBox) { |
| | | //DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | if(keyValue!=null) { |
| | | AttrRangObjectWarper wrapper = new AttrRangObjectWarper(keyValue); |
| | | ((VCIJComboBox) comp).getModel().setSelectedItem(wrapper); |
| | | } |
| | | //model.addElement(wrapper); |
| | | //((VCIJComboBox) comp).setModel(model); |
| | | } |
| | | } |
| | | //} |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | /**校验三:可变码段的校验**/ |
| | | } else if (cType .equals( "codevariablesec")) { |
| | | tempStr = new StringBuffer(); |
| | | tempStr = new StringBuffer(); |
| | | String codeSecLength =secObj.getCodeSecLength(); |
| | | int secLen= Integer.parseInt(codeSecLength); |
| | | //取出用户输入的值 |
| | |
| | | } else if (secType.equals("codelevelsec")) {//层级码段 |
| | | cVal = levelRes; |
| | | } else if (secType.equals("codeserialsec")) { |
| | | continue; |
| | | continue; |
| | | } else { |
| | | cVal = (String) ((VCIJComboBox) secAndComMap.get(secObj.getId())).getSelectedItem(); |
| | | } |
| | |
| | | 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; |
| | |
| | | // 校验长度 |
| | | else if ((value != null && !value.equals("")) |
| | | && value.length() > Integer.valueOf(propObj.getControlLength()) |
| | | && !(propObj.getAttributeDataType().toUpperCase().equals(VciFieldTypeEnum.VTDate)|| |
| | | propObj.getAttributeDataType().toUpperCase().equals(VciFieldTypeEnum.VTDateTime)) |
| | | && !(propObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDate.name())|| |
| | | propObj.getAttributeDataType().equals(VciFieldTypeEnum.VTDateTime.name())) |
| | | ) { |
| | | isExistError = true; |
| | | compt.requestFocus(); |