From 27f7b8f0459ed7c91cd532ae04c9aa3d15d11d84 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期四, 25 五月 2023 17:22:29 +0800
Subject: [PATCH] 接口联调以及接口测试等上传

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   98 ++++++++++++++++++++++++++++--------------------
 1 files changed, 57 insertions(+), 41 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index 08960e7..f96f6f5 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -21,6 +21,9 @@
 import com.vci.ubcs.code.vo.pagemodel.*;
 import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO;
 import com.vci.ubcs.code.vo.pagemodel.UITablePageVO;
+import com.vci.ubcs.omd.feign.IEnumClient;
+import com.vci.ubcs.omd.feign.IEnumItemClient;
+import com.vci.ubcs.omd.vo.EnumVO;
 import com.vci.ubcs.starter.exception.VciBaseException;
 import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
 import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
@@ -31,12 +34,10 @@
 import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
 import com.vci.ubcs.starter.web.pagemodel.*;
 import com.vci.ubcs.starter.web.toolmodel.DateConverter;
-import com.vci.ubcs.starter.web.util.VciBaseUtil;
-import com.vci.ubcs.starter.web.util.VciDateUtil;
-import com.vci.ubcs.starter.web.util.VciQueryWrapperForDO;
-import com.vci.ubcs.starter.web.util.WebUtil;
+import com.vci.ubcs.starter.web.util.*;
 import com.vci.ubcs.system.entity.DictBiz;
 import com.vci.ubcs.system.feign.IDictBizClient;
+import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
 import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,10 +45,13 @@
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.beans.BeanMap;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
@@ -84,10 +88,15 @@
 	@Resource
 	private MdmProductCodeService productCodeService;
 	/**
-	 * 瀛楀吀鐨勬湇鍔�
+	 * 鍙緭鍙�夌殑鏈嶅姟
 	 */
 	@Resource
 	IDictBizClient iDictBizClient;
+	/**
+	 * 瀛楀吀鐨勬湇鍔�
+	 */
+	@Resource
+	IEnumClient enumClient;
 	/**
 	 * 鍏紡鐨勬湇鍔�
 	 */
@@ -244,19 +253,19 @@
 	 */
 	@Override
 	public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) {
-		List<KeyValue> comboboxKVs = null;
+		List<KeyValue> comboboxKVs = new ArrayList<>();
 		if (StringUtils.isNotBlank(attrVO.getEnumString())) {
 			comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class);
 		} else {
 //			comboboxKVs = enumService.getEnum(attrVO.getEnumid());
 //		 	Dict dict = new Dict();
 //			dict.setParentId(Long.valueOf(attrVO.getEnumid()));
-			R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId());
+			R<List<EnumVO>> list = enumClient.getList(attrVO.getEnumId());
 			if(list.isSuccess()){
-				for (DictBiz datum : list.getData()) {
+				for (EnumVO datum : list.getData()) {
 					KeyValue keyValue = new KeyValue();
-					keyValue.setKey(datum.getDictKey());
-					keyValue.setValue(datum.getDictValue());
+					keyValue.setKey(datum.getItemValue());
+					keyValue.setValue(datum.getItemName());
 					comboboxKVs.add(keyValue);
 				}
 			}
@@ -563,7 +572,9 @@
 		//娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
 
 		if (!CollectionUtils.isEmpty(conditionMap)) {
-			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+			//琛ㄩ渶瑕佹敼
+//			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+			final String[] sql = {"select count(*) from pl_code_wupin t where 1 = 1 "};
 			conditionMap.forEach((key, value) -> {
 				sql[0] += " and " + key + " = " + value;
 			});
@@ -700,7 +711,7 @@
 	 */
 	private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupin cbo,
 								CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO,
-								boolean edit) {
+								boolean edit)  {
 		String fullPath = "";
 		if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
 			fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
@@ -710,8 +721,8 @@
 		}
 
 //		BeanUtils.
-		BeanUtils.copyProperties(orderDTO.getData(),cbo);
-		cbo.setMaterialtype(Short.valueOf("1001"));
+//		BeanUtils.copyProperties(orderDTO.getData(),cbo);
+//		cbo.setMaterialtype(Short.valueOf("1001"));
 //		orderDTO.getData().forEach((key, value) -> {
 //			if (!edit || (!checkUnAttrUnEdit(key) &&
 //				!VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
@@ -722,18 +733,19 @@
 //				}
 //			}
 //		});
+//		BeanMap beanMap = BeanMap.create(cbo);
+//		beanMap.putAll(orderDTO.getData());
+
 		try {
+
+			BeanUtilForVCI.copyPropertiesIgnoreNull(BeanUtilForVCI.convertMap(CodeWupin.class,orderDTO.getData()),cbo);
 
 			cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid());
 			cbo.setCodetemplateoid(templateVO.getOid());
 			cbo.setCodeclsfpath(fullPath);
-//			cbo.setMaterialclassify("model_type");
-//			cbo.setMaterialname(orderDTO.getData().get("materialname"));
-//			cbo.setShifoupihaoguanli("true");
-//			cbo.setKucunwl("true");
-//			cbo.setXiaoshouwl("false");
+			cbo.setTs(new Date());
 			if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
-				//鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤�
+				//鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐢熷懡鍛ㄦ湡鏄惁闇�瑕佸垱寤�
 				if (StringUtils.isNotBlank(cbo.getLctid())) {
 //					OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
 //					if (lifeCycleVO != null) {
@@ -748,7 +760,7 @@
 
 			}
 
-			int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString());
+			int secret = VciBaseUtil.getInt(String.valueOf(cbo.getSecretGrade()));
 			//鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢�
 //			if (secret == 0 || !secretService.checkDataSecret(secret)) {
 			if (secret == 0 ) {
@@ -789,13 +801,13 @@
 //		}
 //		ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
 
-		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
-		btmWrapper.eq("ID",btmName);
-		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
+//		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
+//		btmWrapper.eq("ID",btmName);
+//		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
 //		OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
 		String userName = AuthUtil.getUser().getUserName();
 		CodeWupin wupinEntity = new CodeWupin();
-		wupinEntity.setOid(null);
+		wupinEntity.setOid(VciBaseUtil.getPk());
 //		bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
 //		bo.setNameoid((new ObjectUtility()).getNewObjectID36());
 		wupinEntity.setBtmname(btmName);
@@ -807,13 +819,13 @@
 		wupinEntity.setCreateTime(new Date());
 		wupinEntity.setLastModifier(userName);
 		wupinEntity.setLastModifyTime(new Date());
-		wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
-		wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
-		if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
-			//鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
+		wupinEntity.setRevisionRule("numberversionrule");
+		wupinEntity.setVersionRule("0");
+//		if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
+			//
 //			OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
-			wupinEntity.setRevisionValue("1");
-		}
+		wupinEntity.setRevisionValue("1");
+//		}
 
 		wupinEntity.setRevisionSeq(1);
 		wupinEntity.setVersionSeq(1);
@@ -827,7 +839,7 @@
 		wupinEntity.setOwner(userName);
 		wupinEntity.setCheckinby(userName);
 		wupinEntity.setCopyFromVersion("");
-		wupinEntity.setMaterialtype((short) 1001);
+		wupinEntity.setMaterialtype(1001);
 		wupinEntity.setCaigouwl("true");
 		wupinEntity.setShifoupihaoguanli("true");
 		wupinEntity.setKucunwl("true");
@@ -1341,7 +1353,7 @@
 			maps.stream().forEach(map -> {
 				Map<String, String> data = new HashMap<>();
 				map.forEach((key, value) -> {
-					data.put(((String) key).toLowerCase(Locale.ROOT), (String) value);
+					data.put(((String) key).toLowerCase(Locale.ROOT), String.valueOf(value));
 				});
 				dataList.add(data);
 			});
@@ -1514,8 +1526,9 @@
 					referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
 					referVO.setTextField("name");
 				}
-
-				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+				//琛ㄩ渶瑕佹敼
+//				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+				String referTable = "pl_code_wupin";
 				String referTableNick = attrVO.getId() + "0";
 				String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " =  t." + attrVO.getId();
 				joinTableList.put(attrVO.getId(), left);
@@ -1603,7 +1616,9 @@
 			}
 			whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
 		}
-		String tableName = VciBaseUtil.getTableName(btmType);
+		//瑕佹敼锛岃〃鏄庤幏鍙栨湁闂
+//		String tableName = VciBaseUtil.getTableName(btmType);
+		String tableName = "pl_code_wupin";
 		String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
 			+ " from " + tableName + SPACE + "t" + SPACE
 			+ joinTableList.values().stream().collect(Collectors.joining(SPACE))
@@ -2049,12 +2064,13 @@
 		if (!classifyService.checkHasChild(codeClassifyOid)) {
 			conditionMap.put(CODE_CLASSIFY_OID_FIELD, codeClassifyOid);
 		} else {
-			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
-				+ " where lcstatus='" + FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED +
+			//琛ㄩ渶瑕佹敼
+//			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
+			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from pl_code_wupin where lcstatus='" + FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED +
 				"' start with parentCodeClassifyOid = '" + codeClassifyOid + "' CONNECT BY PRIOR OID = parentCodeClassifyOid )");
 		}
-		conditionMap.put("islastr", "1");
-		conditionMap.put("islastv", "1");
+		conditionMap.put("lastr", "1");
+		conditionMap.put("lastv", "1");
 		return queryGrid(btmTypeId, templateVO, conditionMap, pageHelper);
 //        List<String> selectFieldList = templateVO.getAttributes().stream().map(CodeClassifyTemplateAttrVO::getId).collect(Collectors.toList());
 //        //鍙傜収璁╁钩鍙扮洿鎺ユ煡璇㈠氨琛�
@@ -2437,7 +2453,7 @@
 			executionId = executionId.substring(0, executionId.lastIndexOf("."));
 		}
 		String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" +
-			"from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY_PROCESS_TEMPLATE) + " t\n" +
+			"from pl_code_wupin t\n" +
 			"join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" +
 			"where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'";
 //		List<ClientBusinessObject> tempAttrOidArr = boService.queryByOnlySql(sql);

--
Gitblit v1.9.3