From c94de77b03c01b182a46689b2769b8b349fc233f Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期二, 16 一月 2024 08:32:32 +0800
Subject: [PATCH] 读取配置文件属性映射异常信息捕捉细化

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 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 82d9c86..c536b4f 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
@@ -25,7 +25,6 @@
 import com.vci.ubcs.code.vo.pagemodel.UITablePageVO;
 import com.vci.ubcs.code.vo.pagemodel.*;
 import com.vci.ubcs.code.wrapper.BaseMdodelWrapper;
-import com.vci.ubcs.code.wrapper.CodeAllcodeWrapper;
 import com.vci.ubcs.flow.core.dto.FlowStatusDTO;
 import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient;
 import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO;
@@ -42,10 +41,7 @@
 import com.vci.ubcs.starter.revision.model.TreeQueryObject;
 import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
 import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
-import com.vci.ubcs.starter.util.MdmBtmTypeConstant;
-import com.vci.ubcs.starter.util.SaveLogUtil;
-import com.vci.ubcs.starter.util.SpecialCharacterConverter;
-import com.vci.ubcs.starter.util.UBCSSqlKeyword;
+import com.vci.ubcs.starter.util.*;
 import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
 import com.vci.ubcs.starter.web.constant.RegExpConstant;
 import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
@@ -60,13 +56,12 @@
 import com.vci.ubcs.system.feign.ISysClient;
 import com.vci.ubcs.system.user.entity.User;
 import com.vci.ubcs.system.user.feign.IUserClient;
-import io.swagger.models.auth.In;
 import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
 import oracle.sql.TIMESTAMP;
+import org.hibernate.validator.constraints.NotEmpty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.core.cache.utils.CacheUtil;
-import org.springblade.core.log.annotation.OperateLog;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -88,8 +83,6 @@
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
@@ -306,6 +299,7 @@
      * 绌烘牸
      */
     public static final String SPACE = " ";
+
     /**
      * 缂撳瓨锝嬶絽锝�
      */
@@ -456,8 +450,14 @@
 					throw new VciBaseException("鏇存柊鏁版嵁鍑洪敊锛岄噸璇曪紒"+r.getMsg());
 				}
 			}
+			// 鍒氬ソ椤哄簭鏄竴鑷寸殑锛屾墍浠ョ洿鎺ユ寜鐓odeallcode鐨勯『搴忔潵鎷夸笟鍔℃暟鎹�
+			int i = -1;
 			for (CodeAllCode codeCbo : codeCbos) {
 				codeCbo.setLcStatus(baseModelDTO.getLcStatus());
+				// 濡傛灉鏄洖鏀讹紝灏遍渶瑕佸皢涓氬姟鏁版嵁瀛樺偍鍒扮爜鍊艰〃涓�
+				if(baseModelDTO.getLcStatus().equals(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK)){
+					codeCbo.setBusinessData(JSON.toJSONString(baseModels.get(++i)));
+				}
 			}
 			codeAllCodeService.updateBatchById(codeCbos);
 
@@ -1168,10 +1168,7 @@
 							"order by to_char(CREATETIME, 'mm')";
 			//鏌ヨ鍑洪渶瑕佸鐞嗙殑鏁版嵁
 			List<Map> maps = commonsMapper.selectBySql(sql);
-			if(maps.size() == 0){
-				throw new ServiceException("浼犲叆绫诲瀷["+ datum.getName() + ":" +
-					datum.getId() +"]鏈煡鍒扮浉鍏崇粺璁℃暟鎹紝璇风‘璁�!!!!");
-			}
+
 			//褰撳勾姣忔湀鏈堜唤涔嬪墠涔嬪拰
 			List<Integer> monthCount = new ArrayList<>(12);
 			//褰撳勾姣忔湀鐨勬湀浠芥暟鎹�
@@ -1179,12 +1176,16 @@
 			//鑾峰彇褰撳墠鏈堢殑鏁板瓧
 			Calendar instance = Calendar.getInstance();
 			int nowmonth = instance.get(Calendar.MONTH) + 1;
+			if(maps.size() == 0){
+				nowmonth = 0;
+			}
 			//浠�1鍒�12鏈堣繘琛屽鐞�
 			for (Integer i = 1; i <= 12; i++) {
 				//褰撳墠鏈堝悗鎵�鏈夋暟鎹缃负0
 				if(i>nowmonth){
 					monthCount.add(0);
 					month.add(0);
+					continue;
 				}
 				//褰撳墠鏈堜唤涔嬪墠涔嬪拰
 				Integer count = 0;
@@ -2515,7 +2516,6 @@
 				} else {
 					return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE;
 				}
-
 			}else {
 //                if (referFieldMap.containsKey(key)) {
 //                    //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝
@@ -4397,7 +4397,7 @@
             throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
         }
 		// TODO:鍙傜収閰嶇疆鐨勬ā绯婃煡璇㈣繃婊ゆ潯浠舵殏鏈鐞�
-        String namesql = "";
+/*        String namesql = "";
         if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
             String s = baseQueryObject.getConditionMap().get("name");
             s = "%" + s + "%";
@@ -4414,20 +4414,21 @@
         String lcstatusSql = "";
         if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
             lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
-        }
+        }*/
 //        String where = "";
 
 //        if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
 //            where = "where ";
 //        }
+		String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap());
 
-        String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
+		String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
         String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
 
-        List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
+        List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
                 + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
-                + lcstatusSql + namesql + codesql + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
+                + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
+                + whereSqlByMap + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
 		));
         List<BaseModel> baseModels = new ArrayList<>();
         //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
@@ -4475,8 +4476,8 @@
         }
         int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
                 + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
-                + lcstatusSql + namesql + codesql
+                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
+                + whereSqlByMap
         );
         IPage<BaseModelVO> objectDataGrid = new Page<>();
         objectDataGrid.setPages(baseQueryObject.getPage());

--
Gitblit v1.9.3