|
@@ -1410,7 +1410,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
|
|
|
StringBuilder copySql = new StringBuilder();
|
|
|
/*重置内容*/
|
|
|
- Map<String,Map<String,String>> ekvMap = new HashMap<>();
|
|
|
+ Map<String, Map<String, String>> ekvMap = new HashMap<>();
|
|
|
|
|
|
if (StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())) {
|
|
|
WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
|
|
@@ -1483,7 +1483,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
String keys = StringUtils.join(filteredList, ",");
|
|
|
|
|
|
/*重置*/
|
|
|
- Map<String,String> eMap=reviseValue(nodeOld,null,ekvMap);
|
|
|
+ Map<String, String> eMap = reviseValue(nodeOld, null, ekvMap);
|
|
|
//构造入参
|
|
|
String dataSql = "SELECT " + keys + " FROM " + tableName + " WHERE p_key_id= " + nodeOld.getPKeyId() + " LIMIT 1;";
|
|
|
List<LinkedHashMap<String, Object>> resultList = jdbcTemplate.query(dataSql, new RowMapper<LinkedHashMap<String, Object>>() {
|
|
@@ -1504,7 +1504,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (!resultList.isEmpty()) {
|
|
|
LinkedHashMap<String, Object> resultMap = resultList.get(0);
|
|
|
for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
|
|
|
- Object value =reviseValue(eMap,entry.getKey(),entry.getValue());
|
|
|
+ Object value = reviseValue(eMap, entry.getKey(), entry.getValue());
|
|
|
if (value != null) {
|
|
|
if (value.toString().contains("\n")) {
|
|
|
//如果值中包含换行符,则将换行符替换
|
|
@@ -1785,50 +1785,53 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
- static String[] G8_TBN= new String[]{"m_20220922161954_1572863246099021824","m_20220928134702_1574999102784012288"};
|
|
|
- private boolean checkG8(String tableName){
|
|
|
- for (String s:G8_TBN){
|
|
|
- if(s.equals(tableName)) {
|
|
|
+
|
|
|
+ static String[] G8_TBN = new String[]{"m_20220922161954_1572863246099021824", "m_20220928134702_1574999102784012288"};
|
|
|
+
|
|
|
+ private boolean checkG8(String tableName) {
|
|
|
+ for (String s : G8_TBN) {
|
|
|
+ if (s.equals(tableName)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- private Map<String,String> reviseValue(WbsTreeContract wtc,WbsTreeContract parent,Map<String,Map<String,String>> ekvMap){
|
|
|
+
|
|
|
+ private Map<String, String> reviseValue(WbsTreeContract wtc, WbsTreeContract parent, Map<String, Map<String, String>> ekvMap) {
|
|
|
/*复制数据筛查
|
|
|
- * 1.G8G10过滤 2.右键数据重新生成 3.*/
|
|
|
- if(wtc!=null){
|
|
|
+ * 1.G8G10过滤 2.右键数据重新生成 3.*/
|
|
|
+ if (wtc != null) {
|
|
|
try {
|
|
|
- String tableName=wtc.getInitTableName();
|
|
|
- if(parent==null){
|
|
|
- parent = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(wtc.getParentId(),Long.parseLong(wtc.getContractId()));
|
|
|
+ String tableName = wtc.getInitTableName();
|
|
|
+ if (parent == null) {
|
|
|
+ parent = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(wtc.getParentId(), Long.parseLong(wtc.getContractId()));
|
|
|
}
|
|
|
- if(checkG8(tableName)&&!ekvMap.containsKey(tableName)){
|
|
|
- List<Map<String,Object>> listMaps = this.jdbcTemplate.queryForList("select rely from m_formula where number ='TURN_POINT' limit 1");
|
|
|
- if(listMaps.size()>0){
|
|
|
+ if (checkG8(tableName) && !ekvMap.containsKey(tableName)) {
|
|
|
+ List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select rely from m_formula where number ='TURN_POINT' limit 1");
|
|
|
+ if (listMaps.size() > 0) {
|
|
|
String rely = listMaps.get(0).get("rely").toString();
|
|
|
- ekvMap.put(tableName,Arrays.stream(rely.split("[,]")).skip(1).map(e->e.split(":")[1]).collect(Collectors.toMap(e->e,e->"null")));
|
|
|
+ ekvMap.put(tableName, Arrays.stream(rely.split("[,]")).skip(1).map(e -> e.split(":")[1]).collect(Collectors.toMap(e -> e, e -> "null")));
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
FormulaOption formulaOption = this.formulaClient.option(parent.getPKeyId());
|
|
|
- if(formulaOption!=null){
|
|
|
+ if (formulaOption != null) {
|
|
|
JSONObject root = JSON.parseObject(formulaOption.getVal());
|
|
|
JSONObject table = (JSONObject) root.computeIfAbsent(wtc.getInitTableName(), (k) -> new JSONObject());
|
|
|
- Map<String,String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(),K->new HashMap<>());
|
|
|
- table.forEach((k,v)->{
|
|
|
- if(!k.contains("@")){
|
|
|
+ Map<String, String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(), K -> new HashMap<>());
|
|
|
+ table.forEach((k, v) -> {
|
|
|
+ if (!k.contains("@")) {
|
|
|
/*元素级别*/
|
|
|
JSONObject elementJson = (JSONObject) v;
|
|
|
JSONArray rgJson = elementJson.getJSONArray(RangeInfo.RG);
|
|
|
- if(rgJson!=null) {
|
|
|
- map.put(k,rgJson.toJSONString());
|
|
|
+ if (rgJson != null) {
|
|
|
+ map.put(k, rgJson.toJSONString());
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- return ekvMap.getOrDefault(tableName,new HashMap<>());
|
|
|
- }catch (Exception e){
|
|
|
+ return ekvMap.getOrDefault(tableName, new HashMap<>());
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@@ -1836,20 +1839,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private Object reviseValue(Map<String,String> p2 ,String key,Object value){
|
|
|
+ private Object reviseValue(Map<String, String> p2, String key, Object value) {
|
|
|
try {
|
|
|
- if(p2.containsKey(key)){
|
|
|
- String setting= p2.get(key);
|
|
|
- if(StringPool.NULL.equals(setting)){
|
|
|
+ if (p2.containsKey(key)) {
|
|
|
+ String setting = p2.get(key);
|
|
|
+ if (StringPool.NULL.equals(setting)) {
|
|
|
/*擦除原来的内容*/
|
|
|
- return setting;
|
|
|
- }else {
|
|
|
+ return setting;
|
|
|
+ } else {
|
|
|
/*重做随机值*/
|
|
|
List<RangeJson> rjs = JSON.parseArray(setting, RangeJson.class);
|
|
|
if (value != null && value.toString().length() > 0 && Func.isNotEmpty(rjs)) {
|
|
|
List<String[]> la = Arrays.stream(value.toString().split("☆")).map(s -> s.split("_\\^_")).collect(Collectors.toList());
|
|
|
/*全部为一个数的时候不用修改*/
|
|
|
- if (la.stream().map(a -> a[0]).collect(Collectors.toSet()).size() > 1||la.size()==1) {
|
|
|
+ if (la.stream().map(a -> a[0]).collect(Collectors.toSet()).size() > 1 || la.size() == 1) {
|
|
|
/* return la.stream().map(a -> {
|
|
|
String v = a[0];
|
|
|
RangeJson best = rjs.stream().min(Comparator.comparingDouble(j -> Double.parseDouble(v) - Double.parseDouble(j.getDesign()))).orElse(rjs.get(0));
|
|
@@ -1858,27 +1861,28 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return sv + "_^_" + a[1];
|
|
|
}).collect(Collectors.joining());*/
|
|
|
List<String> result = new ArrayList<>();
|
|
|
- for(String[] a:la){
|
|
|
+ for (String[] a : la) {
|
|
|
String v = a[0];
|
|
|
RangeJson best = rjs.stream().min(Comparator.comparingDouble(j -> Double.parseDouble(v) - Double.parseDouble(j.getDesign()))).orElse(rjs.get(0));
|
|
|
int scale = Math.max(new StringBuilder(v).reverse().indexOf("."), 0);
|
|
|
String sv = BaseUtils.rangeList(1, best.getDesign(), best.getDev(), 1, scale, 1).get(0).toString();
|
|
|
result.add(sv + "_^_" + a[1]);
|
|
|
}
|
|
|
- return String.join("☆",result);
|
|
|
+ return String.join("☆", result);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
+
|
|
|
/*元素情况,表字段,表单流水号,数据库表名*/
|
|
|
- private String reviseCols(Map<String,String> p2 ,String cols ,Long pkeyId,String tableName ){
|
|
|
+ private String reviseCols(Map<String, String> p2, String cols, Long pkeyId, String tableName) {
|
|
|
try {
|
|
|
- if(p2.size()>0) {
|
|
|
+ if (p2.size() > 0) {
|
|
|
String dataSql = "SELECT * FROM " + tableName + " WHERE p_key_id= " + pkeyId + " LIMIT 1";
|
|
|
List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList(dataSql);
|
|
|
if (listMaps.size() > 0) {
|
|
@@ -1897,15 +1901,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
cols = String.join(",", target);
|
|
|
}
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return cols;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 重构祖级id
|
|
|
*/
|
|
@@ -2008,9 +2010,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
WbsTreeContract toCopyNodeTab = toCopyNodeTabsMaps.get(pKey);
|
|
|
|
|
|
/*重置内容step1*/
|
|
|
- Map<String,Map<String,String>> ekvMap = new HashMap<>();
|
|
|
+ Map<String, Map<String, String>> ekvMap = new HashMap<>();
|
|
|
/*重置内容step2*/
|
|
|
- Map<String,String> eMap=reviseValue(needTab,null,ekvMap);
|
|
|
+ Map<String, String> eMap = reviseValue(needTab, null, ekvMap);
|
|
|
//如果存在,只复制数据
|
|
|
if (toCopyNodeTab != null) {
|
|
|
Long oldPKeyId = needTab.getPKeyId();
|
|
@@ -2032,8 +2034,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//delete SQL (先删除旧数据,再新增)
|
|
|
String delSql = "delete from " + tableName + " where p_key_id = " + toCopyNodeTab.getPKeyId() + " ; ";
|
|
|
//insert into SQL
|
|
|
- String testColVal=reviseCols(eMap,colVal,oldPKeyId,tableName);
|
|
|
- StaticLog.info("KT3356:"+testColVal);
|
|
|
+ String testColVal = reviseCols(eMap, colVal, oldPKeyId, tableName);
|
|
|
+ StaticLog.info("KT3356:" + testColVal);
|
|
|
copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(testColVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' LIMIT 1;");
|
|
|
resultTablesData.add(copyDataSql.toString());
|
|
|
}
|
|
@@ -2079,8 +2081,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//delete SQL (先删除旧数据,再新增)
|
|
|
String delSql = "delete from " + tableName + " where p_key_id = " + objTab.getPKeyId() + " ; ";
|
|
|
//insert into SQL
|
|
|
- String testColVal=reviseCols(eMap,colVal,oldPKeyId,tableName);
|
|
|
- StaticLog.info("KT3356:"+testColVal);
|
|
|
+ String testColVal = reviseCols(eMap, colVal, oldPKeyId, tableName);
|
|
|
+ StaticLog.info("KT3356:" + testColVal);
|
|
|
copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(testColVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' LIMIT 1;");
|
|
|
resultTablesData.add(copyDataSql.toString());
|
|
|
}
|
|
@@ -2108,7 +2110,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
/*重置内容step1*/
|
|
|
- Map<String,Map<String,String>> ekvMap = new HashMap<>();
|
|
|
+ Map<String, Map<String, String>> ekvMap = new HashMap<>();
|
|
|
//最下层级节点复制
|
|
|
if (var == 1) {
|
|
|
//构造节点
|
|
@@ -2169,7 +2171,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//组织复制表的数据的sql
|
|
|
if (nodeTabColsMap.size() > 0) {
|
|
|
/*重置内容step2*/
|
|
|
- Map<String,String> eMap=reviseValue(needTab,null,ekvMap);
|
|
|
+ Map<String, String> eMap = reviseValue(needTab, null, ekvMap);
|
|
|
|
|
|
StringBuilder copyDataSql = new StringBuilder();
|
|
|
String tableName = obj.getInitTableName();
|
|
@@ -2179,8 +2181,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//delete SQL (先删除旧数据,再新增)
|
|
|
String delSql = "delete from " + tableName + " where p_key_id = " + obj.getPKeyId() + " ; ";
|
|
|
//insert into SQL
|
|
|
- String testColVal=reviseCols(eMap,colVal,oldPKeyId,tableName);
|
|
|
- StaticLog.info("KT3356:"+testColVal);
|
|
|
+ String testColVal = reviseCols(eMap, colVal, oldPKeyId, tableName);
|
|
|
+ StaticLog.info("KT3356:" + testColVal);
|
|
|
copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(testColVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' LIMIT 1;");
|
|
|
resultTablesData.add(copyDataSql.toString());
|
|
|
}
|
|
@@ -2272,7 +2274,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//组织复制表的数据的sql
|
|
|
if (queryProcessDataVO != null) {
|
|
|
/*重置内容step2*/
|
|
|
- Map<String,String> eMap=reviseValue(needTab,null,ekvMap);
|
|
|
+ Map<String, String> eMap = reviseValue(needTab, null, ekvMap);
|
|
|
|
|
|
StringBuilder copyDataSql = new StringBuilder();
|
|
|
String col = queryProcessDataVO.getAncestors();
|
|
@@ -2281,8 +2283,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//delete SQL (先删除旧数据,再新增)
|
|
|
String delSql = "delete from " + tableName + " where p_key_id = " + needTab.getPKeyId() + " ; ";
|
|
|
//insert into SQL
|
|
|
- String testColVal=reviseCols(eMap,colVal,oldPKeyId,tableName);
|
|
|
- StaticLog.info("KT3356:"+testColVal);
|
|
|
+ String testColVal = reviseCols(eMap, colVal, oldPKeyId, tableName);
|
|
|
+ StaticLog.info("KT3356:" + testColVal);
|
|
|
copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(testColVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' LIMIT 1;");
|
|
|
resultTablesData.add(copyDataSql.toString());
|
|
|
}
|
|
@@ -3020,6 +3022,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && treeContract.getNodeName().equals(wbsTreePrivate.getNodeName())) {
|
|
|
newData.setParentId(treeContract.getId());
|
|
|
var = false;
|
|
|
+ } else if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && ObjectUtil.isNotEmpty(treeContract.getOldId()) && treeContract.getOldId().equals(wbsTreePrivate.getId().toString())) {
|
|
|
+ newData.setParentId(treeContract.getId());
|
|
|
+ var = false;
|
|
|
}
|
|
|
}
|
|
|
if (var) {
|