From 5f94dee5c55a03c4b9d3d6cc2f41abfd102e7303 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 02 八月 2023 15:54:48 +0800
Subject: [PATCH] 主数据无流程模板调用状态接口
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 88 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 72 insertions(+), 16 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 8f9a618..7c0751b 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
@@ -425,6 +425,8 @@
// //璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
cbo.setOid(VciBaseUtil.getPk());
+ cbo.setRevisionOid(VciBaseUtil.getPk());
+ cbo.setNameOid(VciBaseUtil.getPk());
cbo.setCreateTime(new Date());
cbo.setLastModifyTime(new Date());
cbo.setCreator(AuthUtil.getUser().getUserName());
@@ -740,7 +742,7 @@
conditionMap.put(queryKey, queryValue);
} else {
//涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
- conditionMap.put("t." + attrId, value);
+ conditionMap.put("t." + attrId, "'" +value+ "'");
}
}
}
@@ -1409,7 +1411,16 @@
public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper);
// List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
- List<Map<String, String>> maps = commonsMapper.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
+ List<Map<String, String>> maps = null;
+ try {
+ maps = commonsMapper.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
+ }catch (Exception e){
+ String errorMessage = e.getMessage();
+ if (errorMessage.contains("鏃犳硶瑙f瀽鐨勬垚鍛樿闂〃杈惧紡")) {
+ throw new ServiceException("缂哄皯"+errorMessage.substring(errorMessage.indexOf("[t.") + 1, errorMessage.indexOf("]"))+"瀛楁");
+ }
+ throw new ServiceException(e.getMessage());
+ }
DataGrid<Map<String, String>> dataGrid = new DataGrid<>();
List<Map<String, String>> dataList = new ArrayList<>();
@@ -2698,7 +2709,7 @@
cbosB.stream().forEach(map -> {
Map<String, String> data = new HashMap<>();
for (Object o : map.keySet()) {
- data.put(((String) o).toLowerCase(Locale.ROOT), String.valueOf(map.get(o)));
+ data.put(((String) o).toLowerCase(Locale.ROOT), map.get(o)==null?"":String.valueOf(map.get(o)));
}
cbos.add(data);
});
@@ -3287,7 +3298,7 @@
throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲瀛楁淇℃伅锛岃妫�鏌ワ紒");
}
Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> {
- return btmTypeAttributeVO.getId();
+ return btmTypeAttributeVO.getId().toLowerCase();
}).collect(Collectors.toSet());
//灏哹ean杞负map,mybatis缁熶竴澶勭悊
List<Map<String, String>> maps = new ArrayList<>();
@@ -3344,13 +3355,17 @@
setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
map.remove(property.getName().toUpperCase());
} else if (map.get(property.getName().toUpperCase()) != null) {
- setter.invoke(obj, map.get(property.getName().toUpperCase()));
+ if(setter.getParameterTypes()[0].getSimpleName().equals("String")){
+ setter.invoke(obj, String.valueOf(map.get(property.getName().toUpperCase())));
+ }else{
+ setter.invoke(obj, map.get(property.getName().toUpperCase()));
+ }
map.remove(property.getName().toUpperCase());
}
}
}
for (Object key : map.keySet()) {
- map.put(key, String.valueOf(map.get(key)));
+ map.put(key, map.get(key) == null ? null : String.valueOf(map.get(key)));
}
((BaseModel) obj).setData(map);
@@ -3374,7 +3389,7 @@
if (!listR.isSuccess() || listR.getData().size() == 0) {
throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
}
- String userName = String.valueOf(AuthUtil.getUser().getUserId());
+// String userName = String.valueOf(AuthUtil.getUser().getUserId());
BaseModel bo = new BaseModel();
// bo.setOid(VciBaseUtil.getPk());
// bo.setRevisionid(VciBaseUtil.getPk());
@@ -3384,16 +3399,16 @@
bo.setFirstR("1");
bo.setFirstV("1");
bo.setLastV("1");
- bo.setCreator(userName);
- bo.setCreateTime(new Date());
- bo.setLastModifier(userName);
- bo.setLastModifyTime(new Date());
bo.setRevisionRule(listR.getData().get(0).getRevisionRuleId());
- bo.setVersionRule(String.valueOf(listR.getData().get(0).getVersionRule()));
+ bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"0":listR.getData().get(0).getVersionRule());
if (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId())) {
R<List<RevisionRuleVO>> revisionRuleVO = revisionRuleClient
- .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId()));
- bo.setRevisionValue(revisionRuleVO.getData().get(0).getStartCode());
+ .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId().toLowerCase()));
+ if(revisionRuleVO.getData().size() != 0 ){
+ bo.setRevisionValue(revisionRuleVO.getData().get(0).getStartCode());
+ }else{
+ bo.setRevisionValue("1");
+ }
}
bo.setRevisionSeq(1);
bo.setVersionSeq(1);
@@ -3406,7 +3421,7 @@
bo.setId("");
bo.setName("");
bo.setDescription("");
- bo.setOwner(userName);
+ bo.setOwner("1");
// bo.setCheckinby(userName);
bo.setCopyFromVersion("");
// this.initTypeAttributeValue(bo,btmTypeVO);
@@ -3661,7 +3676,48 @@
} else {
if (StringUtils.isNotBlank(referConfigVO.getParentFieldName()) && StringUtils.isNotBlank(queryObject.getParentOid())) {
queryObject.getConditionMap().put(referConfigVO.getParentFieldName(), queryObject.getParentOid());
- }
+ //鏌ヨ鍏ㄩ儴鐨勪俊鎭�
+ String parentOidSql = "";
+ if (StringUtils.isNotBlank(referConfigVO.getParentValue())) {
+ String temp = referConfigVO.getParentValue();
+ if (temp.startsWith(QueryOptionConstant.IN)) {
+ temp = temp.substring((QueryOptionConstant.IN).length()).trim();
+ parentOidSql = " in " + "('" + queryObject.getParentOid() + "')";
+ } else if (temp.startsWith(QueryOptionConstant.NOTIN)) {
+ parentOidSql = " not in " + "('" + queryObject.getParentOid() + "')";
+ } 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 + "'");
+ }
+
+ }
+ //鏌ヨ鍏ㄩ儴鐨勪俊鎭�
+ queryObject.getConditionMap().put("oid", QueryOptionConstant.IN + "(select oid from " +
+ getTableName(referConfigVO.getReferType()) +
+ " START WITH " + referConfigVO.getParentFieldName() + " " +
+ parentOidSql +
+ " CONNECT BY PRIOR " + oidFieldName + " = " + referConfigVO.getParentFieldName() + ")");
+ }
}
LambdaQueryWrapper<CodeClassify> lqw = new LambdaQueryWrapper<>();
String sql = queryObject.getConditionMap().get("oid").substring(3);
--
Gitblit v1.9.3