From dbe1b807e2a0e4aaa37277b69c50dd69dc42dda2 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 25 六月 2023 10:34:36 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

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

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
index f5714e3..4d865ed 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -759,7 +759,7 @@
 	 * @return 鏈夐敊璇俊鎭殑excel
 	 */
 	@Override
-	public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) {
+	public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) throws  Throwable{
 		VciBaseUtil.alertNotNull(codeClassifyOid,"鍒嗙被鐨勪富閿�");
 		ReadExcelOption reo = new ReadExcelOption();
 		reo.setReadAllSheet(true);
@@ -1895,9 +1895,30 @@
 		getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap);
 		Map<String, String> cboOidMap = new HashMap<>();
 		cboOidMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDataMap.keySet().toArray(new String[0])) + ")");
-		R<BtmTypeVO>  r= btmTypeClient.getDetail(templateVO.getBtmTypeId());
-		BtmTypeVO btmTypeVO =r.getData();
-		String tableName=btmTypeVO.getTableName();
+		String tableName ="";
+		try {
+			R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
+			if(r.getCode()!=200) {
+				throw new Throwable(r.getMsg());
+			}
+			BtmTypeVO btmTypeVO = r.getData();
+			if (btmTypeVO == null) {
+				throw new Throwable("鏍规嵁涓氬姟绫诲瀷鏈煡璇㈠埌涓氬姟绫诲瀷瀵硅薄锛�");
+			}
+			tableName = btmTypeVO.getTableName();
+			if (StringUtils.isBlank(tableName)) {
+				throw new Throwable("鏍规嵁涓氬姟绫诲瀷鏈煡璇㈠埌涓氬姟绫诲瀷鐩稿叧鑱旂殑琛�");
+			}
+		}catch (Throwable e){
+			log.error("鏌ヨ涓氬姟瀵硅薄琛�"+e);
+			XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO=new XMLResultDataObjectDetailDO();
+			xmlResultDataObjectDetailDO.setErrorid("103");
+			xmlResultDataObjectDetailDO.setMsg("鏌ヨ涓氬姟瀵硅薄琛�"+e);
+			xmlResultDataObjectDetailDO.setId("");
+			xmlResultDataObjectDetailDO.setCode("");
+			resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO);
+			return;
+		}
 
 		StringBuffer sb=new StringBuffer();
 		sb.append(" select * from ");
@@ -2978,21 +2999,35 @@
 	 * @param cboList 鏁版嵁鐨勫垪琛�
 	 * @param errorMap 閿欒鐨勪俊鎭�
 	 */
-	private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap){
+	private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap) throws Throwable{
 		List<String> existIds = new ArrayList<>();
+		String tableName ="";
+		try {
+			R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
+			if(r.getCode()!=200) {
+				throw new Throwable(r.getMsg());
+			}
+			BtmTypeVO btmTypeVO = r.getData();
+			if (btmTypeVO == null) {
+				throw new Throwable("鏍规嵁涓氬姟绫诲瀷鏈煡璇㈠埌涓氬姟绫诲瀷瀵硅薄锛�");
+			}
+			tableName = btmTypeVO.getTableName();
+			if (StringUtils.isBlank(tableName)) {
+				throw new Throwable("鏍规嵁涓氬姟绫诲瀷鏈煡璇㈠埌涓氬姟绫诲瀷鐩稿叧鑱旂殑琛�");
+			}
+		}catch (Throwable e){
+			throw e;
+		}
+		String finalTableName = tableName;
 		VciBaseUtil.switchCollectionForOracleIn(cboList).stream().forEach(cbos -> {
 			Map<String, String> conditionMap = new HashMap<>();
 			conditionMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])) + ")");
 
-			R<BtmTypeVO>  r= btmTypeClient.getDetail(templateVO.getBtmTypeId());
-			BtmTypeVO btmTypeVO =r.getData();
-			String tableName=btmTypeVO.getTableName();
-
 			StringBuffer sb=new StringBuffer();
 			sb.append(" select id from ");
-			sb.append(tableName);
+			sb.append(finalTableName);
 			sb.append(" where 1=1 ");
-			sb.append(" id in (");
+			sb.append(" and id in (");
 			sb.append(VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])));
 			sb.append(")");
 			List<String> idList= commonsMapper.selectById(sb.toString());

--
Gitblit v1.9.3