From 153a4048e410a789a0da4eda0af09b2ca645bec3 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 12 十月 2023 10:24:08 +0800
Subject: [PATCH] 系统管理-取消列显隐
---
Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeApplyFor410MainPanel.java | 154 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 111 insertions(+), 43 deletions(-)
diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeApplyFor410MainPanel.java b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeApplyFor410MainPanel.java
index c648cc4..b6e9a52 100644
--- a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeApplyFor410MainPanel.java
+++ b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeApplyFor410MainPanel.java
@@ -1,23 +1,28 @@
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;
@@ -27,12 +32,12 @@
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 {
@@ -84,8 +89,12 @@
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<>();
/**
* 灞炴�D涓庡睘鎬у搴旂殑鎺т欢涔嬮棿鐨勬槧灏凪AP
*/
@@ -117,11 +126,12 @@
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;
}
/**
@@ -158,13 +168,16 @@
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){
List<CodeBasicSecVO> codeBasicSecVOList=codeRuleVO.getSecVOList();
@@ -476,7 +489,7 @@
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();
@@ -577,7 +590,7 @@
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();
}
@@ -590,10 +603,10 @@
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);
/**浠g爜椤逛笅鎷変簨浠�**/
@@ -632,11 +645,12 @@
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())) {
@@ -742,10 +756,16 @@
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());
@@ -785,7 +805,7 @@
if (index >= realAttrs.length) {
break;
}
- CodeClassifyTemplateAttrVO attrObj = realAttrs[index];
+ final CodeClassifyTemplateAttrVO attrObj = realAttrs[index];
/***濡傛灉妯℃澘閰嶇疆浜嗗紩鐢ㄦā鏉匡紝灞炴�у悕绉板垪琛ㄦ坊鍔犻摼鎺ヨ繘琛屽鐞� BEGIN**/
//ADD BY liujw
@@ -951,10 +971,19 @@
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())){//鍙傜収鐨勯渶瑕佽缃垚涓嬫媺妗嗭紝骞朵笖鍙
@@ -968,43 +997,78 @@
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);
}
boolean enabled = true;
- /*// 闆嗗洟浠g爜銆侀泦鍥㈤檮鍔犵爜涓嶅彲浠ユ墜宸ュ綍鍏ユ暟鎹�
- if (attrObj.getId().equals(Constants.GROUP_CODE_INNERNAME)|| attrObj.getInternalname().equals(Constants.GROUP_ADD_CODE_INNERNAME)) {
+ // 闆嗗洟浠g爜銆侀泦鍥㈤檮鍔犵爜涓嶅彲浠ユ墜宸ュ綍鍏ユ暟鎹�
+ if (attrObj.getId().toLowerCase().equals("groupcode")) {
enabled = false;
- }*/
+ }
compt.setEnabled(enabled);
}
@@ -1036,9 +1100,9 @@
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();
}
}
@@ -1153,7 +1217,8 @@
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();
@@ -1170,7 +1235,7 @@
}
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());
@@ -1263,7 +1328,7 @@
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;
@@ -1552,7 +1617,10 @@
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;
--
Gitblit v1.9.3