| | |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.ConfigUtils; |
| | | import com.vci.rmip.code.client.codeapply.Apply410.utils.HttpUtil; |
| | | 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; |
| | |
| | | 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"; |
| | |
| | | * @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); |
| | |
| | | } |
| | | } |
| | | 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) { |
| | |
| | | |
| | | 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> |
| | |
| | | // 校验长度 |
| | | 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(); |