| | |
| | | import com.vci.base.ui.swing.VCIOptionPane; |
| | | import com.vci.base.ui.swing.components.*; |
| | | import com.vci.base.ui.tree.VCIBaseTreeNode; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.codeapply.object.*; |
| | | import com.vci.ubcs.codeapply.swing.IntegerTextField; |
| | | import com.vci.ubcs.codeapply.swing.RealTextField; |
| | | import com.vci.ubcs.codeapply.swing.VCIJComboxBox; |
| | | import com.vci.ubcs.codeapply.utils.ConfigUtils; |
| | | import com.vci.ubcs.codeapply.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 com.vci.ubcs.system.user.entity.User; |
| | | import net.bytebuddy.implementation.bytecode.Throw; |
| | | import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | |
| | |
| | | import javax.swing.text.JTextComponent; |
| | | import javax.swing.tree.TreeNode; |
| | | import java.awt.*; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.awt.event.MouseAdapter; |
| | | import java.awt.event.MouseEvent; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | |
| | | |
| | | public class CodeApplyFor410MainPanel extends VCIJPanel { |
| | | |
| | | |
| | | private String url=ConfigUtils.getConfigValue("410.code.url","http://127.0.0.1:36014/codeApplySwingController"); |
| | | //410新需求 |
| | | private final String SPECIAL_RULE_NAME="Special.rule.name"; |
| | | private final String SPECIAL_SECTION_NAME = "Special.section.name"; |
| | |
| | | this.loadTextAreaEnableEnv(); //add by liujw |
| | | //this.loadSpecialRuleConfig(); |
| | | CodeClassify rmType = (CodeClassify) this.transTreeObject.getCurrentTreeNode().getObj(); |
| | | String url= ConfigUtils.getConfigValue("410.PDM.rule.url","http://127.0.0.1:36014/codeApplySwingController/getCodeRuleByClassifyFullInfo"); |
| | | //String url= ConfigUtils.getConfigValue("410.PDM.rule.url","http://127.0.0.1:36014/codeApplySwingController/getCodeRuleByClassifyFullInfo"); |
| | | /**系统只加载代码项 如果libName不为空,直接获取对应的代码项**/ |
| | | Map<String,String> condtionMap=new HashMap<>(); |
| | | condtionMap.put("codeClassId", rmType.getOid()); |
| | | R r=HttpUtil.sendGet(url,condtionMap,new HashMap<>()); |
| | | R r= HttpUtil.sendGet(url+"/getCodeRuleByClassifyFullInfo",condtionMap,new HashMap<>()); |
| | | CodeRuleVO codeRuleVO=new CodeRuleVO(); |
| | | if(r.isSuccess()){ |
| | | Object object= r.getData(); |
| | |
| | | VCIJComboxBox hisCombo = null; |
| | | try { |
| | | final Map<String, String> secValMap = getSpecialValMap(specialSecVals); |
| | | Map<String,List<String>> secIdTOListValueOidMap=new HashMap<>(); |
| | | for(int k = 0;k < secObjs.length; k++) { |
| | | final CodeBasicSecVO secObj = secObjs[k]; |
| | | final VCIJComboxBox secCombo = secCombos[k]; |
| | |
| | | return; |
| | | } |
| | | if (secObj.getSecType().equals("codeclassifysec")) {// 是分类码 |
| | | continue; |
| | | } else |
| | | // 是固定码 |
| | | if (secObj.getSecType() .equals("codefixedsec")) { |
| | | /* SectionValueClientDelegate codeValDel = new SectionValueClientDelegate(userObj); |
| | | FixCodeValObject[] codeValObjs = codeValDel.fetchFixCodeValBySecId(secObj.getId());// 获取该码段下的所有码段码值对象 |
| | | //如果只有一个值,则系统默认选择,不加空值 |
| | | if(codeValObjs.length > 1 ) { |
| | | secCombo.addItem(new FixCodeValObject()); |
| | | String secOid=secObj.getOid(); |
| | | String parentClassifySecOid= secObj.getParentClassifySecOid(); |
| | | String parentClassifyValueOid=""; |
| | | if(secIdTOListValueOidMap.containsKey(parentClassifySecOid)){ |
| | | List<String> parentClassifyValueList= secIdTOListValueOidMap.get(parentClassifySecOid); |
| | | parentClassifyValueOid= VciBaseUtil.array2String(parentClassifyValueList.toArray(new String[]{})); |
| | | } |
| | | for (int i = 0; i < codeValObjs.length; i++) { |
| | | secCombo.addItem(codeValObjs[i]); |
| | | Map<String,String> condtionMap=new HashMap<>(); |
| | | condtionMap.put("secOid", secOid); |
| | | condtionMap.put("parentClassifyValueOid", parentClassifyValueOid); |
| | | R r=HttpUtil.sendGet(url+"/listCodeClassifyValueBySecOid",condtionMap,new HashMap<>()); |
| | | 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 com.fasterxml.jackson.core.type.TypeReference<List<CodeClassifyValue>>() {}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | VCIOptionPane.showMessage(this,r.getMsg()); |
| | | } |
| | | *//**当系统选择的是指定码段值时,组别代号的码段系统不显示 Begin**//* |
| | | FixCodeValObject selObj = (FixCodeValObject) secCombo.getSelectedItem(); |
| | | if(isSpecialRuleFlag && (secObj.getName().equals(specialControlSecName) && secValMap.containsKey(selObj.getValue())) || secValMap.containsKey(getControlSecSelectValue())) { |
| | | setComponentStatus(false); |
| | | }else { |
| | | setComponentStatus(true); |
| | | List<String>valueOidList=new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyValueList)) { |
| | | if(codeClassifyValueList.size()>1) { |
| | | secCombo.addItem(new CodeClassifyValue()); |
| | | } |
| | | codeClassifyValueList.stream().forEach(codeClassifyValue -> { |
| | | secCombo.addItem(codeClassifyValue); |
| | | valueOidList.add(codeClassifyValue.getOid()); |
| | | }); |
| | | } |
| | | if (secCombo.getItemCount() > 10){ |
| | | secIdTOListValueOidMap.put(secObj.getOid(),valueOidList); |
| | | /**代码项下拉事件**/ |
| | | secCombo.addActionListener(new ActionListener() { |
| | | public void actionPerformed(ActionEvent e) { |
| | | if(secCombo.getSelectedIndex() == -1) { |
| | | return; |
| | | } |
| | | if(secIdToClsfIdMap.containsKey(secObj.getId())){ |
| | | VCIJTextField secDescVcijTextField=(VCIJTextField)secIdToClsfIdMap.get(secObj.getId()); |
| | | CodeClassifyValue codeClassifyValue= (CodeClassifyValue) secCombo.getSelectedItem(); |
| | | secDescVcijTextField.setText(codeClassifyValue.getName()); |
| | | } |
| | | } |
| | | }); |
| | | /*if (secCombo.getItemCount() > 10){ |
| | | if (!secCombo.isFlag()){ |
| | | secCombo.setFlag(true); |
| | | secCombo.getSearchBtn().setVisible(true); |
| | |
| | | secCombo.setFlag(false); |
| | | secCombo.getSearchBtn().setVisible(false); |
| | | }*/ |
| | | |
| | | } else |
| | | // 是固定码 |
| | | 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**/ |
| | | /*FixCodeValObject selObj = (FixCodeValObject) secCombo.getSelectedItem(); |
| | | if(isSpecialRuleFlag && (secObj.getName().equals(specialControlSecName) && secValMap.containsKey(selObj.getValue())) || secValMap.containsKey(getControlSecSelectValue())) { |
| | | setComponentStatus(false); |
| | | }else { |
| | | setComponentStatus(true); |
| | | }*/ |
| | | /*if (secCombo.getItemCount() > 10){ |
| | | if (!secCombo.isFlag()){ |
| | | secCombo.setFlag(true); |
| | | secCombo.getSearchBtn().setVisible(true); |
| | | secCombo.getSearchBtn().addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | doSearch(secCombo); |
| | | } |
| | | }); |
| | | } |
| | | }else { |
| | | secCombo.setFlag(false); |
| | | secCombo.getSearchBtn().setVisible(false); |
| | | }*/ |
| | | } else |
| | | // 是日期码段 |
| | | if (secObj.getSecType().equals("codedatesec")) { |
| | | /*SectionClientDelegate secDel = new SectionClientDelegate(userObj); |
| | | DateSecObject dateObj = secDel.fetchDateSecById(secObj.getId()); |
| | | String df = dateObj.getFormat(); |
| | | SimpleDateFormat dateFormate = new SimpleDateFormat(df); |
| | | String curDate = dateFormate.format(Calendar.getInstance().getTime()); |
| | | secCombo.addItem(curDate); |
| | | if(dateObj.getIsModify().equals("Y")){//可以修改 |
| | | secCombo.setEditable(true); |
| | | }*/ |
| | | 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")) { |
| | | /*RMTypeObject rmObj = (RMTypeObject) this.transTreeObject.getCurrentTreeNode().getObj(); |
| | | secCombo.addItem(rmObj);*/ |
| | | } else { |
| | | secCombo.setEditable(true); |
| | | } |
| | | CodeClassify rmObj = (CodeClassify) this.transTreeObject.getCurrentTreeNode().getObj(); |
| | | secCombo.addItem(rmObj); |
| | | } else { |
| | | secCombo.setEditable(true); |
| | | } |
| | | } |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | cbx.setModel(model); |
| | | compt = cbx; |
| | | } |
| | | } else if(StringUtils.isNotBlank(attrObj.getReferConfig())){//参照的需要设置成下拉框,并且只读 |
| | | VCIJComboBox cbx = new VCIJComboBox(); |
| | | DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | KeyValue keyValue = new KeyValue(); |
| | | keyValue.setValue(""); |
| | | keyValue.setKey(""); |
| | | AttrRangObjectWarper wrapper = new AttrRangObjectWarper(keyValue); |
| | | model.addElement(wrapper); |
| | | cbx.setModel(model); |
| | | compt = cbx; |
| | | } else { // 不存在取值范围则按类型生成不同的控件 |
| | | if (attrObj.getAttributeDataType().equals(VciFieldTypeEnum.VTBoolean)) { // Boolean类型 |
| | | VCIJComboBox cbx = new VCIJComboBox(); |
| | |
| | | */ |
| | | private KeyValue[] getAttrRangeObjects(String attrId){ |
| | | KeyValue[] res = new KeyValue[0]; |
| | | String url= ConfigUtils.getConfigValue("410.PDM.attrKeyValue.url","http://127.0.0.1:36014/codeApplySwingController/listComboboxItems"); |
| | | //String url= ConfigUtils.getConfigValue("410.PDM.attrKeyValue.url","http://127.0.0.1:36014/codeApplySwingController/listComboboxItems"); |
| | | /**系统只加载代码项 如果libName不为空,直接获取对应的代码项**/ |
| | | Map<String,String> condtionMap=new HashMap<>(); |
| | | condtionMap.put("oid", attrId); |
| | | R r=HttpUtil.sendGet(url,condtionMap,new HashMap<>()); |
| | | R r=HttpUtil.sendGet(url+"/listComboboxItems",condtionMap,new HashMap<>()); |
| | | List<KeyValue> keyValueList=new ArrayList<>(); |
| | | if(r.isSuccess()){ |
| | | Object object= r.getData(); |
| | |
| | | // 流程任务引用 |
| | | // 一般的数据录入、修改 |
| | | // 不同的来源,需要维护好Owner父 |
| | | VCIJDialog ownerDialog = realDialogInstance; |
| | | /*VCIJDialog ownerDialog = realDialogInstance; |
| | | if(ownerDialog == null){ |
| | | ownerDialog = new VCIJDialog(); |
| | | ownerDialog.setSize(880, 500); |
| | | } |
| | | final String referTempId = tempPropObj.getReferBtmId(); |
| | | final RMDataReferTempDialog dialog = new RMDataReferTempDialog(ownerDialog, referTempId); |
| | | }*/ |
| | | //final String referTempId = tempPropObj.getReferBtmId(); |
| | | final RMDataReferTempDialog dialog = new RMDataReferTempDialog(this,tempPropObj); |
| | | dialog.setDialogCallback(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | /*LinkedList<RMDataObject> list = dialog.getRMDataMainPanel().getTablePanel().getSelectedRowObjects(); |
| | | if(dialog.isFromTableDoubleClick()){ |
| | | KeyValue keyValue=new KeyValue(); |
| | | /*if(dialog.isFromTableDoubleClick()){ |
| | | int index = dialog.getRMDataMainPanel().getTablePanel().getTable().getSelectedRow(); |
| | | list.clear(); |
| | | list.add(dialog.getRMDataMainPanel().getTablePanel().getTableModel().getList().get(index).getObject()); |
| | | } |
| | | |
| | | RMDataObject rmDataObj = list.get(0);//选择的引用模板数据 |
| | | LinkedHashMap<String, Integer> innnerNamesMaps = rmDataObj.getInnerNameIndexMap(); |
| | | String[] datas = rmDataObj.getDatas(); |
| | | for(CodeClassifyTemplateAttrVO obj : tempPropList) { |
| | | if(obj.getReferTempId().equals(referTempId)) { |
| | | AttributeObject attrObj = getAttrObjById(obj.getReferAttrId()); |
| | | JComponent comp = attrIdToCtrlMaps.get(obj.getId()); |
| | | if(comp instanceof VCIJTextField) { |
| | | int index = innnerNamesMaps.get(attrObj.getInternalname()); |
| | | }*/ |
| | | keyValue= dialog.getKeyValue(); |
| | | //for(CodeClassifyTemplateAttrVO obj : tempPropList) { |
| | | 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]); |
| | | }else if (comp instanceof VCIJCalendarPanel) { |
| | | int index = innnerNamesMaps.get(attrObj.getInternalname()); |
| | | int index = innnerNamesMaps.get(tempPropObj.getInternalname()); |
| | | ((VCIJCalendarPanel) comp).setDateString(datas[index]); |
| | | } else if (comp instanceof VCIJComboBox) { |
| | | int index = innnerNamesMaps.get(attrObj.getId()); |
| | | ((VCIJComboBox) comp).setSelectedIndex(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); |
| | | } |
| | | } |
| | | }*/ |
| | | //} |
| | | |
| | | } |
| | | }); |
| | | //dialog.initDialogSize(ownerDialog.getWidth(), ownerDialog.getHeight()); |
| | | Dimension dime = Toolkit.getDefaultToolkit().getScreenSize(); |
| | | int x = dime.width/2 - 400; |
| | | int y = dime.height/2 -400; |
| | | int y = dime.height/2 -300; |
| | | dialog.setLocation(x, y); |
| | | dialog.setSize(new Dimension(900, 800)); |
| | | dialog.setSize(new Dimension(900, 600)); |
| | | dialog.setModal(true); |
| | | dialog.setVisible(true); |
| | | } |