From 6bccfd2132c8523b5ebeffa772a8fa0e784d8165 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 01 八月 2023 10:17:50 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

---
 Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyFor410MainPanel.java |  160 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 112 insertions(+), 48 deletions(-)

diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyFor410MainPanel.java b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyFor410MainPanel.java
index 8854c9f..a28ca65 100644
--- a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyFor410MainPanel.java
+++ b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/ubcs/codeapply/CodeApplyFor410MainPanel.java
@@ -5,10 +5,7 @@
 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;
@@ -16,6 +13,8 @@
 import com.vci.ubcs.codeapply.utils.ConfigUtils;
 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;
@@ -25,8 +24,11 @@
 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;
@@ -34,7 +36,7 @@
 
 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";
@@ -141,11 +143,11 @@
 		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();
@@ -545,6 +547,7 @@
 		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];
@@ -552,27 +555,56 @@
 					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);
+					/**浠g爜椤逛笅鎷変簨浠�**/
+					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);
@@ -587,19 +619,51 @@
 						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")) {
@@ -630,13 +694,13 @@
 					}
 
 				*/} 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();
@@ -1003,11 +1067,11 @@
 	 */
 	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();
@@ -1143,13 +1207,13 @@
 		// 娴佺▼浠诲姟寮曠敤
 		// 涓�鑸殑鏁版嵁褰曞叆銆佷慨鏀�
 		// 涓嶅悓鐨勬潵婧愶紝闇�瑕佺淮鎶ゅソ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 RMDataReferTempDialog dialog = new RMDataReferTempDialog(this,tempPropObj);
 		dialog.setDialogCallback(new Runnable() {
 			@Override
 			public void run() {
@@ -1185,9 +1249,9 @@
 		//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);
 	}

--
Gitblit v1.9.3