From fcb858cfc776a7960ff5a42703e6892557ba07df Mon Sep 17 00:00:00 2001
From: weidy <lastanimals@163.com>
Date: 星期三, 05 七月 2023 20:35:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 41 insertions(+), 19 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 db221da..97ddf3e 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
@@ -1,13 +1,11 @@
 package com.vci.ubcs.code.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
 import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO;
 import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
@@ -68,7 +66,6 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
-
 import javax.annotation.Resource;
 import java.beans.BeanInfo;
 import java.beans.Introspector;
@@ -365,7 +362,10 @@
         // 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄�
         if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
             R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(baseModelDTO.getBtmname()));
-            commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()));
+			if (!listR.isSuccess() || listR.getData().size() == 0) {
+				throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+			}
+			commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()));
         } else {
             for (BaseModel baseModel : baseModels) {
                 baseModel.setLcStatus(baseModelDTO.getLcStatus());
@@ -646,6 +646,9 @@
 //			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
             R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmtypeid()));
 //				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+			if (!listR.isSuccess() || listR.getData().size() == 0) {
+				throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+			}
             final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
             conditionMap.forEach((key, value) -> {
                 sql[0] += " and " + key + " = " + value;
@@ -1221,7 +1224,8 @@
             fieldVO.setTemplet(attrVO.getTableDisplayJs());
         }
         if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())) {
-            fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}");
+            fieldVO.setTemplet("function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'}");
+//            fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}");
         }
         fieldVO.setOptionJsMap(eventJsMap);
         fieldVO.setStyle(attrVO.getTableDisplayStyle());
@@ -1595,6 +1599,9 @@
                 //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
                 R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referVO.getReferType()));
 //				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+				if (!listR.isSuccess() || listR.getData().size() == 0) {
+					throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+				}
                 String referTable = listR.getData().get(0).getTableName();
 //				String referTable = "pl_code_classify";
                 String referTableNick = attrVO.getId() + "0";
@@ -1691,6 +1698,9 @@
         }
 //		String tableName = VciBaseUtil.getTableName(btmType);
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
 //				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
         String tableName = listR.getData().get(0).getTableName();
         String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
@@ -2229,9 +2239,9 @@
 //		baseMapper.deleteBatchIds(cboList);
         //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid()));
-        if (listR.getData().size() == 0) {
-            throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
-        }
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
         commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(),
                 "'" + (StringUtils.join(cboList.stream().map(BaseModel::getOid).collect(Collectors.toSet()), "','")) + "'");
         //		);
@@ -3166,9 +3176,9 @@
     public Integer insertBatchByType(String btmType, List<BaseModel> baseModels) {
         //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
-        if (listR.getData().size() == 0) {
-            throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
-        }
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
         //灏哹ean杞负map,mybatis缁熶竴澶勭悊
         List<Map<String, String>> maps = new ArrayList<>();
         baseModels.stream().forEach(model -> {
@@ -3193,9 +3203,9 @@
 
         //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
-        if (listR.getData().size() == 0) {
-            throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
-        }
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
         //鏌ヨ鏁版嵁
         List<Map> maps = commonsMapper.selectBySql("select * from " + listR.getData().get(0).getTableName() + " where oid in ("
                 + VciBaseUtil.toInSql(oids.toString()) + ")");
@@ -3251,6 +3261,9 @@
      */
     public BaseModel createBaseModel(String boName) {
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName));
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
         String userName = String.valueOf(AuthUtil.getUser().getUserId());
         BaseModel bo = new BaseModel();
 //		bo.setOid(VciBaseUtil.getPk());
@@ -3318,9 +3331,9 @@
     public R updateBatchByBaseModel(String btmType, List<BaseModel> baseModels) {
         //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
-        if (listR.getData().size() == 0) {
-            throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
-        }
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
         //灏哹ean杞负map,mybatis缁熶竴澶勭悊
         List<Map<String, String>> maps = new ArrayList<>();
 
@@ -3352,7 +3365,13 @@
 		//checkReferConfig(referConfigVO);
         //浣跨敤涓氬姟绫诲瀷鏌ヨ
         R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
-        BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
+		if (allAttributeByBtmId.getCode() != 200) {
+			throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒锛�");
+		}
+		if (Func.isEmpty(allAttributeByBtmId.getData())) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
+		BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
         /**
          * 鍔犱笂鏌ヨ鏈�鏂扮増娆�
          */
@@ -3579,7 +3598,10 @@
         toBo.setVersionRule(fromBo.getVersionRule());
 //		RevisionValueObject rvObj = this.getNextRevision(fromBo.getBtmName(), fromBo.getNameoid(), item.revRuleName, item.revInput, revisionVal);
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(fromBo.getBtmname()));
-        Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid());
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
+		Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid());
         toBo.setRevisionSeq(Integer.parseInt(nextRevision.get("REVISIONSEQ").toString()));
         toBo.setRevisionValue(nextRevision.get("REVISIONVAL").toString());
 //		VersionValueObject versionObj = this.getVersionValue(item.verRuleName);

--
Gitblit v1.9.3