From 57dc6de265b63e8ea1432985e9daea86210888d5 Mon Sep 17 00:00:00 2001 From: xiejun <xiejun@vci-tech.com> Date: 星期二, 07 一月 2025 23:31:02 +0800 Subject: [PATCH] 产品型号集成,类型转换,人员组织加日志,申请接口引用码段值校验 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java | 208 +++++++++++++++++++++++++++++++++++++++-- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeMdmInfaceImpl.java | 71 +++++++++++++- 2 files changed, 262 insertions(+), 17 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeMdmInfaceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeMdmInfaceImpl.java index 3e2905a..040630c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeMdmInfaceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeMdmInfaceImpl.java @@ -56,6 +56,8 @@ import javax.servlet.http.HttpServletRequest; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ForkJoinPool; @@ -175,7 +177,7 @@ List<ResultMdMapping> resultMdMappingList=new ArrayList<>(); String message=""; AtomicBoolean success = new AtomicBoolean(true); - List<Map<String,String>> masterDataList = new ArrayList<>(); + List<Map<String,Object>> masterDataList = new ArrayList<>(); AtomicReference<ClassifyConfig> currentClassifyConfig = new AtomicReference<>(new ClassifyConfig()); try { if (mdmParamData == null) { @@ -215,12 +217,14 @@ }); masterDataList.stream().forEach(masterData -> { masterData.forEach((field, vaule) -> { + String newValue=""; if (fieldClassifyConfigMap.containsKey(field)) { - vaule=StringUtils.isBlank(vaule) ? "" : vaule; + //vaule=StringUtils.isBlank(vaule) ? "" : vaule; + newValue=objectToStr(vaule); List<ClassifyConfig> classifyConfigs = fieldClassifyConfigMap.get(field); Map<String, ClassifyConfig> classifyConfigMap = classifyConfigs.stream().filter(classify -> classify != null && StringUtils.isNotBlank(classify.getSourceClassifyCode())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceClassifyCode(), t -> t)); - if (classifyConfigMap.containsKey(vaule)) { - currentClassifyConfig.set(classifyConfigMap.get(vaule)); + if (classifyConfigMap.containsKey(newValue)) { + currentClassifyConfig.set(classifyConfigMap.get(newValue)); } } }); @@ -284,8 +288,9 @@ /*** * 鏍规嵁閰嶇疆鏂囦欢鑾峰彇鏋氫妇鍊� */ + String newValue=objectToStr(vaule); if(fields.contains(field)){//濡傛灉鏄灇涓撅紝鍒欓渶瑕佽浆鎹㈡灇涓惧�� - String enumFiled = masterData.get(field); + String enumFiled = newValue; EnumerableData enumerableData = JSONObject.toJavaObject(JSONObject.parseObject(enumFiled), EnumerableData.class); String enumCode = enumerableData.getCode(); //String enumCodeValue=enumerableData.getName(); @@ -296,7 +301,7 @@ }else { ProppertyVO proppertyVO = new ProppertyVO(); proppertyVO.setKey(field); - proppertyVO.setValue(vaule); + proppertyVO.setValue(newValue); proppertyVOList.add(proppertyVO); } @@ -824,4 +829,58 @@ dockingLogeService.save(dockingLoge); log.info("闆嗘垚鎺ㄩ�佹暟鎹�,systemId:"+systemId+",systemname:"+systemName+",operation:"+operation+",param:"+parmaData); } + + /*** + * 灞炴�х被鍨嬭浆鎹� + * @param vaule + * @return + */ + private String objectToStr(Object vaule){ + String newValue=""; + if(vaule ==null||"".equals(vaule)||vaule==""){ + return ""; + } + if(vaule instanceof Integer){ + Integer intValue=(Integer)vaule; + newValue=String.valueOf(intValue); + }else if (vaule instanceof Boolean){ + boolean boolValue=(Boolean) vaule; + newValue=Boolean.toString(boolValue); + }else if(vaule instanceof Timestamp){ + Timestamp timestampValue=(Timestamp)vaule; + newValue=timestamp2Str(timestampValue); + }else if(vaule instanceof Date){ + Date dataValue=(Date) vaule; + newValue = date2Str(dataValue,"yyyy-MM-dd HH:mm:ss"); + }else { + return vaule.toString(); + } + return newValue; + } + + private String date2Str(Date date, String format) { + if (null == date) { + return null; + } else { + if (format == null || format.trim().length() == 0) { + format = "yyyy-MM-dd HH:mm:ss.SSS"; + } + + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } + } + + private String timestamp2Str(Timestamp time) { + Date date = null; + if (null == time) { + return null; + } else { + if (null != time) { + date = new Date(time.getTime()); + } + + return date2Str(date, "yyyy-MM-dd HH:mm:ss.SSS"); + } + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java index 4690e47..70b78a1 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java @@ -78,6 +78,7 @@ import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST; import static com.vci.ubcs.code.enumpack.CodeSecTypeEnum.CODE_CLASSIFY_SEC; +import static com.vci.ubcs.code.enumpack.CodeSecTypeEnum.CODE_REFER_SEC; /*** * 缁熶竴鎺ュ彛 @@ -283,6 +284,7 @@ } }catch (Throwable e){ errorid[0] ="101"; + log.error("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�",e); throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"); } ClassfysVO classfysVO = interParameterVO.getData().getClassifys(); @@ -368,6 +370,7 @@ } catch (Throwable e) { List<ApplyDataVO> applyDataVOList= classVO.getObjects().getObject(); objerrorCode="1"; + log.error("缂栫爜鐢宠澶辫触:",e); if(!CollectionUtils.isEmpty(applyDataVOList)) { applyDataVOList.stream().forEach(applyDataVO -> { XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); @@ -386,7 +389,7 @@ resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); } e.printStackTrace(); - log.error(e.getMessage()); + //log.error(e.getMessage()); }finally { XMLResultClassfyVO resultClassfyVO = new XMLResultClassfyVO(); resultClassfyVO.setClassCode(classVO.getClassCode()); @@ -405,7 +408,8 @@ }catch (Throwable e){ e.printStackTrace(); msg="鐢宠缂栫爜澶辫触:"+e.getMessage(); - log.error(msg); + //log.error(msg); + log.error("缂栫爜鐢宠澶辫触:",e); /* XMLResultSystemVO XMLResultSystemVO=new XMLResultSystemVO(); XMLResultSystemVO.setErrorid(errorid); XMLResultSystemVO.setMsg("鐢宠缂栫爜澶辫触锛�->"+e.getMessage()); @@ -441,7 +445,8 @@ this.saveLogs(systemId, systemId, data, resultStr, issucess[0], msg, "applyCode"); }catch (Throwable e){ e.printStackTrace(); - log.error(e.getMessage()); + //log.error(e.getMessage()); + log.error("淇濆瓨鏃ュ織鍑洪敊,鍘熷洜:",e); } } log.info("杩斿洖鍙傛暟:"+resultStr); @@ -475,6 +480,7 @@ try { passwordFreeLoginService.pwdFreeLoginByBoolean(systemCode.toLowerCase(),this.getRequest()); }catch (Throwable e){ + log.error("鐢ㄦ埛閴存潈澶辫触:",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } masterDataList = personData.getMasterData(); @@ -671,6 +677,7 @@ } } } catch (Exception e) { + log.error("鏁版嵁淇濆瓨澶辫触:",e); mesg=e.getMessage(); e.printStackTrace(); throw new ServiceException(e.getMessage()); @@ -705,6 +712,7 @@ success.set(false); message = "浜哄憳鏁版嵁鎺ユ敹澶辫触:"+e.getMessage(); msg = "浜哄憳鏁版嵁鎺ユ敹澶辫触:"+e.getMessage(); + log.error( "浜哄憳鏁版嵁鎺ユ敹澶辫触:",e); //缁勭粐杩斿洖缁撴灉 boolean finalSuccess = success.get(); String finalMessage = message; @@ -729,6 +737,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemCode, systemCode, data, resultStr, success.get(), msg, "syncDataForPerson"); }catch (Throwable e){ + log.error( "鏃ュ織淇濆瓨澶辫触:",e); e.printStackTrace(); } } @@ -762,6 +771,7 @@ try { passwordFreeLoginService.pwdFreeLoginByBoolean(systemCode.toLowerCase(),this.getRequest()); }catch (Throwable e){ + log.error( "鐢ㄦ埛閴存潈澶辫触:",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } orgMasterDataList = orgData.getMasterData(); @@ -986,6 +996,7 @@ success.set(false); message = "閮ㄩ棬鏁版嵁鎺ユ敹澶辫触:"+e.getMessage(); msg = "閮ㄩ棬鏁版嵁鎺ユ敹澶辫触:"+e.getMessage(); + log.error( "閮ㄩ棬鏁版嵁鎺ユ敹澶辫触:",e); //缁勭粐杩斿洖缁撴灉 boolean finalSuccess = success.get(); String finalMessage = message; @@ -1010,6 +1021,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemCode, systemCode, data, resultStr, success.get(), msg, "syncDataForOrg"); }catch (Throwable e){ + log.error( "淇濆瓨鏃ュ織澶辫触:",e); e.printStackTrace(); } } @@ -1066,6 +1078,7 @@ passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(),this.getRequest()); }catch (Throwable e){ errorid = "1"; + log.error("鐢ㄦ埛閴存潈澶辫触",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } List<ClassfyVO> classVOList = classfysVO.getClassify(); @@ -1121,6 +1134,8 @@ mdmIOService.batchSyncEditDatas(codeClassifyVO,dataObjectVO, resultDataObjectDetailDOs,isCodeOrGroupCode); log.info("end锛氫慨鏀规暟鎹墽琛屽畬姣�"); } catch (Throwable e) { + msg="缂栫爜鏇存敼/鐘舵�佹洿鏀�/鍒犻櫎:"; + log.error(msg,e); List<ApplyDataVO> applyDataVOList= classVO.getObjects().getObject(); objerrorCode="1"; if(!CollectionUtils.isEmpty(applyDataVOList)) { @@ -1154,6 +1169,7 @@ }catch (Throwable e){ e.printStackTrace(); msg="缂栫爜鏇存敼/鐘舵�佹洿鏀�/鍒犻櫎:"+e.getMessage(); + log.error(msg,e); /* XMLResultSystemVO XMLResultSystemVO=new XMLResultSystemVO(); XMLResultSystemVO.setErrorid(errorid); XMLResultSystemVO.setMsg("鐢宠缂栫爜澶辫触锛�->"+e.getMessage()); @@ -1188,6 +1204,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemId, systemId, data, resultStr, issucess[0], msg, "syncEditData"); }catch (Throwable e){ + log.error("淇濆瓨鏃ュ織澶辫触",e); e.printStackTrace(); } } @@ -1236,6 +1253,7 @@ errorid = "101"; msg="鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"; e.printStackTrace(); + log.error("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�",e); throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"); } QueryData queryData=queryClassifyVO.getData(); @@ -1342,7 +1360,9 @@ resultData.setLibrary(libraryVo); }catch (Throwable e){ e.printStackTrace(); + msg="鏌ヨ鍒嗙被澶辫触:"+e.getMessage(); + log.error(msg,e); }finally { resultData.setErrorid(errorid); resultData.setMsg(msg); @@ -1363,6 +1383,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemId, systemId, data, resultStr, issucess, msg, "queryClassify"); }catch (Throwable e){ + log.error("淇濆瓨鏃ュ織淇℃伅澶辫触锛�",e); e.printStackTrace(); } log.info("杩斿洖鍙傛暟:"+resultStr); @@ -1402,6 +1423,7 @@ errorid = "101"; msg = "鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"; e.printStackTrace(); + log.error( "鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�",e); throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"); } CondtionsVO condtionsVO=dataCondtionsVO.getCondtions(); @@ -1413,6 +1435,7 @@ passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(),this.getRequest()); }catch (Throwable e){ errorid = "1"; + log.error("鐢ㄦ埛閴存潈澶辫触",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } CondtionVO condtionVO= condtionsVO.getCondtion(); @@ -1567,7 +1590,9 @@ } }catch (Throwable e){ e.printStackTrace(); + msg="鏌ヨ鏁版嵁澶辫触:"+e.getMessage(); + log.error(msg,e); }finally { resultDataVO.setErrorid(errorid); resultDataVO.setMsg(msg); @@ -1587,6 +1612,7 @@ try { //璁板綍鏃ュ織 this.saveLogs(systemId, systemId, data, resultStr, issucess, msg, "queryData"); }catch (Throwable e){ + log.error("淇濆瓨鏃ュ織淇℃伅澶辫触:",e); e.printStackTrace(); } log.info("杩斿洖鍙傛暟:"+resultStr); @@ -1625,6 +1651,7 @@ } catch (Throwable e) { errorid = "101"; msg = "鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"; + log.error(msg,e); e.printStackTrace(); throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"); } @@ -1637,6 +1664,7 @@ passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(),this.getRequest()); }catch (Throwable e){ errorid = "1"; + log.error("鐢ㄦ埛閴存潈澶辫触",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } @@ -2025,6 +2053,7 @@ }catch (Throwable e){ e.printStackTrace(); msg="鏌ヨ鍒嗙被澶辫触:"+e.getMessage(); + log.error("鏌ヨ鍒嗙被澶辫触:",e); }finally { resultClassifyRuleData.setErrorid(errorid); resultClassifyRuleData.setMsg(msg); @@ -2045,6 +2074,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemId, systemId, data, resultStr, issucess, msg, "queryClassifyRule"); }catch (Throwable e){ + log.error("淇濆瓨鏃ュ織淇℃伅澶辫触:",e); e.printStackTrace(); } log.info("杩斿洖鍙傛暟:"+resultStr); @@ -2089,6 +2119,7 @@ } } catch (Throwable e) { errorid[0] = "101"; + log.error("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�:",e); throw new Throwable("鎺ュ彛鍙傛暟锛氫紶鍏ユ暟鎹弬鏁拌В鏋愬け璐�"); } classfyBZVO = applyBZParamVO.getData().getClassify(); @@ -2100,6 +2131,7 @@ passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(),this.getRequest()); }catch (Throwable e){ errorid[0] = "1"; + log.error("鐢ㄦ埛閴存潈澶辫触:",e); throw new Throwable("鐢ㄦ埛閴存潈澶辫触"); } //杩欐槸璐﹀彿淇℃伅 @@ -2205,6 +2237,7 @@ } catch (Throwable e) { objerrorCode = "1"; msg="缂栫爜鐢宠澶辫触:" +e.getMessage(); + log.error(msg,e); e.printStackTrace(); }finally { XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO = new XMLResultDataObjectDetailDO(); @@ -2229,6 +2262,7 @@ }catch (Throwable e){ e.printStackTrace(); msg="鐢宠缂栫爜澶辫触:"+e.getMessage(); + log.error(msg,e); }finally { XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO(); xmlResultSystemVO.setClassifys(resultClassfyVOList); @@ -2254,6 +2288,7 @@ //璁板綍鏃ュ織 this.saveLogs(systemId, systemId, data, resultStr, issucess[0], msg, "applyCodeForBZ"); }catch (Throwable e){ + log.error("淇濆瓨鏃ュ織淇℃伅澶辫触锛�",e); e.printStackTrace(); } } @@ -2308,6 +2343,7 @@ } }catch (Throwable e){ objerrorCode="100"; + log.error("鑾峰彇鍒嗙被淇℃伅澶辫触:",e); throw new Throwable("鑾峰彇鍒嗙被淇℃伅澶辫触:"+e.getMessage()); } return classifyVO; @@ -2351,6 +2387,7 @@ } }catch (Throwable e){ objerrorCode="100"; + log.error("鑾峰彇鍒嗙被淇℃伅澶辫触:",e); throw new Throwable("鑾峰彇鍒嗙被淇℃伅澶辫触:"+e.getMessage()); } return classifyVO; @@ -2398,7 +2435,7 @@ Map<String,String> errorMap=new HashMap<>(); for(CodeBasicSecVO codeBasicSecVO: codeBasicSecVOS) { String sectype = codeBasicSecVO.getSecType(); - String newSecName=codeBasicSecVO.getName(); + // String newSecName=codeBasicSecVO.getName(); String classifySecOid= codeBasicSecVO.getOid(); String message=""; if (!sectype.equals(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue())) { @@ -2411,11 +2448,10 @@ CodeOrderSecDTO.setSecOid(codeBasicSecVO.getOid()); String sectypeValue = sectionVOMap.get(name); log.info("鐮佹鍊�:"+sectypeValue); - CodeSecTypeEnum secType = CodeSecTypeEnum.forValue(sectype); - if(CODE_CLASSIFY_SEC.equals(secType)) {//濡傛灉鏄垎绫荤殑璇濓紝鍒欓渶瑕佸尮閰嶄紶杩囨潵鐨勫垎绫讳唬鍙蜂笌 + // CodeSecTypeEnum secType = CodeSecTypeEnum.forValue(sectype); + if(CODE_CLASSIFY_SEC.getValue().equals(sectype)) {//濡傛灉鏄垎绫荤殑璇濓紝鍒欓渶瑕佸尮閰嶄紶杩囨潵鐨勫垎绫讳唬鍙蜂笌 //鍏堢畝绉版槸鍚︽湁鍏宠仈妯℃澘锛屾湁妯℃澘瑕佸厛鍒犻櫎 List<CodeClassifyValue> codeClassifyValueDOList = codeClassifyValueService.list(Wrappers.<CodeClassifyValue>query().lambda().eq(CodeClassifyValue::getCodeClassifySecOid,classifySecOid)); - if (!CollectionUtils.isEmpty(codeClassifyValueDOList)) { Map<String, CodeClassifyValue> codeClassifyValueDOMap = codeClassifyValueDOList.stream().collect(Collectors.toMap(s -> s.getId(), t -> t, (o1, o2) -> o2)); if(codeClassifyValueDOMap.containsKey(sectypeValue)){ @@ -2427,9 +2463,155 @@ errorMap.put("error",errorMap.getOrDefault("error","")+";"+message); } } + }else if(CODE_REFER_SEC.getValue().equals(sectype)){ + String referBtmId=codeBasicSecVO.getReferBtmId(); + String btmName=codeBasicSecVO.getReferBtmName(); + String referConfig= codeBasicSecVO.getReferConfig(); + CoderefersecSearchVO coderefersecSearchVO=new CoderefersecSearchVO(); + if(StringUtils.isNotBlank(referConfig)){ + coderefersecSearchVO = JSONObject.toJavaObject(JSONObject.parseObject(referConfig), CoderefersecSearchVO.class); + } + String buildSqlwhere=""; + List<CodeSectionValueVO> codeSectionValueVOList=new ArrayList<>(); + if(coderefersecSearchVO!=null) { + if (coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.DEFAULT.getValue()) || coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.GRID.getValue())) {//榛樿鏍峰紡/鍒楄〃 + Map<String, Object> condtionMap = new HashMap<>(); + List<CodeSrchCondConfigVO> codeSrchCondConfigVOList = coderefersecSearchVO.getCodeSrchCondConfigVOS(); + + if (!CollectionUtils.isEmpty(codeSrchCondConfigVOList)) { + codeSrchCondConfigVOList.stream().forEach(codeSrchCondConfigVO -> { + condtionMap.put(codeSrchCondConfigVO.getFilterField() + codeSrchCondConfigVO.getFilterType(), codeSrchCondConfigVO.getFilterValue()); + }); + buildSqlwhere = UBCSSqlKeyword.buildSqlwhere(condtionMap); + } + + //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃 + R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referBtmId)); + if (!listR.isSuccess() || listR.getData().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); + } + String referTable = listR.getData().get(0).getTableName(); + StringBuffer sb = new StringBuffer(); + sb.append(" select * from "); + sb.append(referTable); + sb.append(" where 1=1 "); + if (StringUtils.isNotBlank(buildSqlwhere)) { + sb.append(buildSqlwhere); + } + List<Map> ListMap = commonsMapper.selectBySql(sb.toString()); + String valueField = coderefersecSearchVO.getValueField(); + String textField = coderefersecSearchVO.getTextField(); + final int[] num = {0}; + if (!CollectionUtils.isEmpty(ListMap)) { + ListMap.stream().forEach(map -> { + num[0]++; + String id = Func.isNull(map.getOrDefault("OID".toUpperCase(Locale.ROOT), "")) ? "" : map.getOrDefault("OID".toUpperCase(Locale.ROOT), "").toString(); + String value = Func.isNull(map.getOrDefault(valueField.toUpperCase(Locale.ROOT), "")) ? "" : map.getOrDefault(valueField.toUpperCase(Locale.ROOT), "").toString(); + String text = Func.isNull(map.getOrDefault(textField.toUpperCase(Locale.ROOT), "")) ? "" : map.getOrDefault(textField.toUpperCase(Locale.ROOT), "").toString(); + String description = Func.isNull(map.getOrDefault("description".toUpperCase(Locale.ROOT), "")) ? "" : map.getOrDefault("description".toUpperCase(Locale.ROOT), "").toString(); + CodeSectionValueVO sectionValueVO = new CodeSectionValueVO(id, num[0] + "", value, id, "", description); + codeSectionValueVOList.add(sectionValueVO); + }); + } + }else if (coderefersecSearchVO.getType().equals(CodeReferConfigTypeEnum.TREE.getValue())) {//鏍戝舰 + Map<String, Object> condtionMap = new HashMap<>(); + + //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃 + R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referBtmId)); + if (!listR.isSuccess() || listR.getData().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); + } + String referTable = listR.getData().get(0).getTableName(); + + String oidFieldName = StringUtils.isNotBlank(coderefersecSearchVO.getParentUsedField())?coderefersecSearchVO.getParentUsedField():coderefersecSearchVO.getValueField(); + String parentValue =coderefersecSearchVO.getParentValue(); + String parentFieldName =StringUtils.isBlank(coderefersecSearchVO.getParentFieldName())?"":coderefersecSearchVO.getParentFieldName(); + List<CodeSrchCondConfigVO> codeSrchCondConfigVOList = coderefersecSearchVO.getCodeSrchCondConfigVOS(); + List<CodeShowFieldConfigVO> codeShowFieldConfigVOS=coderefersecSearchVO.getCodeShowFieldConfigVOS(); + if (!CollectionUtils.isEmpty(codeSrchCondConfigVOList)) { + codeSrchCondConfigVOList.stream().forEach(codeSrchCondConfigVO -> { + condtionMap.put(codeSrchCondConfigVO.getFilterField() + codeSrchCondConfigVO.getFilterType(), codeSrchCondConfigVO.getFilterValue()); + }); + buildSqlwhere = UBCSSqlKeyword.buildSqlwhere(condtionMap); + } + + //if("all".equals(coderefersecSearchVO.getLoadType())) { + String parentOidSql = ""; + if(StringUtils.isNotBlank(parentValue)){ + String temp=parentValue; + if(temp.startsWith(QueryOptionConstant.IN)){ + temp = temp.substring((QueryOptionConstant.IN).length()).trim(); + parentOidSql = " in " + ((temp.startsWith("(") && temp.endsWith(")"))?temp:"(" + temp + ")"); + }else if(temp.startsWith(QueryOptionConstant.NOTIN)){ + parentOidSql = " not in " + ((temp.startsWith("(") && temp.endsWith(")"))?temp:"(" + temp + ")"); + }else if(temp.startsWith(QueryOptionConstant.NOTEQUAL)){ + temp = temp.substring((QueryOptionConstant.NOTEQUAL).length()).trim(); + parentOidSql = QueryOptionConstant.NOTEQUAL + " " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + }else if(temp.startsWith(QueryOptionConstant.MORETHAN)){ + temp = temp.substring((QueryOptionConstant.MORETHAN).length()).trim(); + parentOidSql = QueryOptionConstant.MORETHAN + " " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + }else if(temp.startsWith(QueryOptionConstant.MORE)){ + temp = temp.substring((QueryOptionConstant.MORE).length()).trim(); + parentOidSql = QueryOptionConstant.MORE + " " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + }else if(temp.startsWith(QueryOptionConstant.LESSTHAN)){ + temp = temp.substring((QueryOptionConstant.LESSTHAN).length()).trim(); + parentOidSql = QueryOptionConstant.LESSTHAN + " " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + }else if(temp.startsWith(QueryOptionConstant.LESS)){ + temp = temp.substring((QueryOptionConstant.LESS).length()).trim(); + parentOidSql = QueryOptionConstant.LESS + " " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + }else if (temp.startsWith(QueryOptionConstant.ISNOTNULL)) { + parentOidSql = " is not null"; + } else if (temp.startsWith(QueryOptionConstant.ISNULL)) { + parentOidSql = " is null"; + } else if(temp.contains("*")){ + parentOidSql = " like " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'").replace("*","%"); + }else { + parentOidSql = " = " + ((temp.startsWith("'") && temp.endsWith("'"))?temp:"'" + temp + "'"); + } + } + //鏌ヨ鍏ㄩ儴鐨勪俊鎭� + buildSqlwhere+= " and oid in (select oid from " +referTable + " START WITH " + coderefersecSearchVO.getParentFieldName() + " "+ + parentOidSql + + " CONNECT BY PRIOR " + oidFieldName + " = " + parentFieldName + ")"; + StringBuffer sb = new StringBuffer(); + sb.append(" select * from "); + sb.append(referTable); + sb.append(" where 1=1 "); + if (StringUtils.isNotBlank(buildSqlwhere)) { + sb.append(buildSqlwhere); + } + List<Map> ListMap = commonsMapper.selectBySql(sb.toString()); + String valueField = coderefersecSearchVO.getValueField(); + String textField = coderefersecSearchVO.getTextField(); + final int[] num = {0}; + if (!CollectionUtils.isEmpty(ListMap)) { + ListMap.stream().forEach(map -> { + num[0]++; + String id =Func.isNull(map.getOrDefault("OID".toUpperCase(Locale.ROOT), ""))?"":map.getOrDefault("OID".toUpperCase(Locale.ROOT), "").toString(); + String value =Func.isNull(map.getOrDefault(valueField.toUpperCase(Locale.ROOT), ""))?"":map.getOrDefault(valueField.toUpperCase(Locale.ROOT), "").toString(); + String text =Func.isNull(map.getOrDefault(textField.toUpperCase(Locale.ROOT), ""))?"":map.getOrDefault(textField.toUpperCase(Locale.ROOT), "").toString(); + String description =Func.isNull(map.getOrDefault("description".toUpperCase(Locale.ROOT), ""))?"":map.getOrDefault("description".toUpperCase(Locale.ROOT), "").toString(); + String pid =Func.isNull(map.getOrDefault(parentFieldName.toUpperCase(Locale.ROOT), ""))?"":map.getOrDefault(parentFieldName.toUpperCase(Locale.ROOT), "").toString(); + CodeSectionValueVO sectionValueVO = new CodeSectionValueVO(id, num[0] + "", value, text, pid, description); + codeSectionValueVOList.add(sectionValueVO); + }); + } + } + } + if(!CollectionUtils.isEmpty(codeSectionValueVOList)){ + Map<String, CodeSectionValueVO> codeSectionValueVOMap = codeSectionValueVOList.stream().collect(Collectors.toMap(s -> s.getValue(), t -> t, (o1, o2) -> o2)); + if(!codeSectionValueVOMap.containsKey(sectypeValue)){ + message="浼犲叆鐨勭紪鐮佽鍒欑爜娈�:銆�"+name+"銆戜负"+CODE_REFER_SEC.getText()+",鍏跺搴旂殑鍊硷紝鍦ㄧ紪鐮佺郴缁熶笉瀛樺湪"; + errorMap.put("error",errorMap.getOrDefault("error","")+";"+message); + } + }else{ + message="浼犲叆鐨勭紪鐮佽鍒欑爜娈�:銆�"+name+"銆戜负"+CODE_REFER_SEC.getText()+",鍏跺搴旂殑鍊硷紝鍦ㄧ紪鐮佺郴缁熶笉瀛樺湪"; + errorMap.put("error",errorMap.getOrDefault("error","")+";"+message); + } } - if(StringUtils.isBlank(sectypeValue)&&!newSecName.equals(secName)){ - message="浼犲叆鐨勫垎绫荤爜娈碉細銆�" + name + " 銆戠殑鍊间笉鍏佽涓虹┖"; + + if(StringUtils.isBlank(sectypeValue)&&!name.equals(secName)){ + message="浼犲叆鐨勭爜娈碉細銆�" + name + " 銆戠殑鍊间笉鍏佽涓虹┖"; errorMap.put("error",errorMap.getOrDefault("error","")+";"+message); } CodeOrderSecDTO.setSecValue(sectypeValue); @@ -2475,6 +2657,7 @@ } catch (Throwable e) { objerrorCode = "1"; e.printStackTrace(); + log.error("闆嗘垚绯荤粺灞炴�ч厤缃枃浠惰鍙栧け璐ワ細",e); throw new Throwable("闆嗘垚绯荤粺鏍囪瘑涓猴細銆�" + systemId + "銆戯紝鍒嗙被搴撲负:銆�" + libray + "銆戠殑闆嗘垚灞炴�ч厤缃枃浠惰鍙栧け璐�"); } // String path = stringStringMap.get(systemId); @@ -2570,7 +2753,8 @@ dataObjectVO.setRowData(rowDataList); }catch (Throwable e){ objerrorCode="1"; - throw new Throwable("缁勭粐鏁版嵁鏄犲皠鍊煎け璐�"); + log.error("缁勭粐灞炴�ф槧灏勫�煎け璐ワ細",e); + throw new Throwable("缁勭粐灞炴�ф槧灏勫�煎け璐�"); } } @@ -2601,6 +2785,7 @@ } catch (Throwable e) { objerrorCode = "1"; e.printStackTrace(); + log.error("闆嗘垚灞炴�ч厤缃枃浠惰鍙栧け璐ワ細",e); throw new Throwable("闆嗘垚绯荤粺鏍囪瘑涓猴細銆�" + systemId + "銆戯紝鍒嗙被搴撲负:銆�" + libray + "銆戠殑闆嗘垚灞炴�ч厤缃枃浠惰鍙栧け璐�"); } // String path = stringStringMap.get(systemId); @@ -2701,7 +2886,8 @@ dataObjectVO.setRowData(rowDataList); }catch (Throwable e){ objerrorCode="1"; - throw new Throwable("缁勭粐鏁版嵁鏄犲皠鍊煎け璐�"); + log.error("缁勭粐灞炴�ф槧灏勫�煎け璐ワ細",e); + throw new Throwable("缁勭粐灞炴�ф槧灏勫�煎け璐�"); } } -- Gitblit v1.9.3