|
@@ -38,6 +38,7 @@ import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.evisa.feign.EVisaClient;
|
|
import org.springblade.evisa.feign.EVisaClient;
|
|
import org.springblade.evisa.vo.CertBeanVO;
|
|
import org.springblade.evisa.vo.CertBeanVO;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
@@ -356,6 +357,15 @@ public class InformationWriteQueryController extends BladeController {
|
|
if (StringUtils.isNotEmpty(copyVO.getNeedCopyPrimaryKeyId()) && copyVO.getCopyBatchToPaths().size() > 0) {
|
|
if (StringUtils.isNotEmpty(copyVO.getNeedCopyPrimaryKeyId()) && copyVO.getCopyBatchToPaths().size() > 0) {
|
|
//查询被复制节点
|
|
//查询被复制节点
|
|
WbsTreeContract wbsTreeContract = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyVO.getNeedCopyPrimaryKeyId());
|
|
WbsTreeContract wbsTreeContract = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyVO.getNeedCopyPrimaryKeyId());
|
|
|
|
+
|
|
|
|
+ //获取数据写入的节点信息
|
|
|
|
+ List<CopyContractTreeNodeVO.CopyBatch> batchPathList = copyVO.getCopyBatchToPaths();
|
|
|
|
+ //获取数据源节点
|
|
|
|
+ CopyContractTreeNodeVO.CopyBatch copyBatchResource = batchPathList.stream().filter(f -> f.getPrimaryKeyId().equals(wbsTreeContract.getPKeyId().toString())).findAny().orElse(null);
|
|
|
|
+ if (copyBatchResource != null) {
|
|
|
|
+ return R.fail("请选择除【" + wbsTreeContract.getNodeName() + "】源节点之外的节点进行复制");
|
|
|
|
+ }
|
|
|
|
+
|
|
String tabOwner;
|
|
String tabOwner;
|
|
if (("1,2").equals(copyVO.getClassify()) || ("2,1").equals(copyVO.getClassify())) {
|
|
if (("1,2").equals(copyVO.getClassify()) || ("2,1").equals(copyVO.getClassify())) {
|
|
tabOwner = "1,2,3,4,5,6";
|
|
tabOwner = "1,2,3,4,5,6";
|
|
@@ -378,31 +388,51 @@ public class InformationWriteQueryController extends BladeController {
|
|
//获取源数据
|
|
//获取源数据
|
|
Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
|
|
Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
|
|
for (WbsTreeContract treeContract : tableList) {
|
|
for (WbsTreeContract treeContract : tableList) {
|
|
- List<Map<String, Object>> tableBusinessData = this.jdbcTemplate.queryForList("select * from " + treeContract.getInitTableName() + " where p_key_id = " + treeContract.getPKeyId());
|
|
|
|
- if (tableBusinessData.size() > 0) {
|
|
|
|
- //设置参数
|
|
|
|
- List<List<Map<String, Object>>> list;
|
|
|
|
- if (tableBusinessDataMap.containsKey(treeContract.getId().toString())) {
|
|
|
|
- list = tableBusinessDataMap.get(treeContract.getId().toString());
|
|
|
|
- } else {
|
|
|
|
- list = new ArrayList<>();
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(treeContract.getInitTableName())) {
|
|
|
|
+ //判断表是否存在
|
|
|
|
+ String isExitSql = "select * from information_schema.TABLES where TABLE_NAME='" + treeContract.getInitTableName() + "'";
|
|
|
|
+ List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
|
|
|
|
+ if (tabList.size() == 0) {
|
|
|
|
+ continue; //未找到实体表跳过
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String sql = "select * from " + treeContract.getInitTableName() + " where p_key_id = " + treeContract.getPKeyId();
|
|
|
|
+ List<Map<String, Object>> tableBusinessData = this.jdbcTemplate.queryForList(sql);
|
|
|
|
+ if (tableBusinessData.size() > 0) {
|
|
|
|
+ //设置参数
|
|
|
|
+ List<List<Map<String, Object>>> list;
|
|
|
|
+ if (tableBusinessDataMap.containsKey(treeContract.getId().toString())) {
|
|
|
|
+ list = tableBusinessDataMap.get(treeContract.getId().toString());
|
|
|
|
+ } else {
|
|
|
|
+ list = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ list.add(tableBusinessData);
|
|
|
|
+ tableBusinessDataMap.put(treeContract.getId().toString(), list);
|
|
}
|
|
}
|
|
- list.add(tableBusinessData);
|
|
|
|
- tableBusinessDataMap.put(treeContract.getId().toString(), list);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //获取数据写入的节点信息
|
|
|
|
- List<CopyContractTreeNodeVO.CopyBatch> batchPathList = copyVO.getCopyBatchToPaths();
|
|
|
|
//删除数据SQL
|
|
//删除数据SQL
|
|
List<String> removeSqlList = new ArrayList<>();
|
|
List<String> removeSqlList = new ArrayList<>();
|
|
//新增数据SQL
|
|
//新增数据SQL
|
|
List<String> saveSqlList = new ArrayList<>();
|
|
List<String> saveSqlList = new ArrayList<>();
|
|
|
|
+ //已上报状态的节点名称
|
|
|
|
+ Map<String, String> taskStatusMap = new HashMap<>();
|
|
|
|
|
|
for (CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList) {
|
|
for (CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList) {
|
|
//获取选择的节点信息
|
|
//获取选择的节点信息
|
|
WbsTreeContract selectNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
|
|
WbsTreeContract selectNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
|
|
|
|
|
|
|
|
+ //判断该节点是否已上报,1=待审批,2=已审批均属于已上报
|
|
|
|
+ String sqlSb = "select classify from u_information_query where type = 1 and status in (1,2) and wbs_id = " + selectNode.getPKeyId() + " and classify in (" + copyVO.getClassify() + ")";
|
|
|
|
+ List<InformationQuery> query = jdbcTemplate.query(sqlSb, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ for (InformationQuery informationQuery : query) {
|
|
|
|
+ taskStatusMap.put((new Integer(1)).equals(informationQuery.getClassify()) ? "施工" : "监理", selectNode.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
//实际获取的数据
|
|
//实际获取的数据
|
|
Map<String, List<List<Map<String, Object>>>> currentDataMap = new HashMap<>();
|
|
Map<String, List<List<Map<String, Object>>>> currentDataMap = new HashMap<>();
|
|
|
|
|
|
@@ -468,6 +498,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (taskStatusMap.size() > 0) {
|
|
|
|
+ List<String> str = new ArrayList<>();
|
|
|
|
+ for (Map.Entry<String, String> map : taskStatusMap.entrySet()) {
|
|
|
|
+ str.add("【" + map.getValue() + "-" + map.getKey() + "】");
|
|
|
|
+ }
|
|
|
|
+ String join = StringUtils.join(str, "、");
|
|
|
|
+ return R.fail(StringUtil.format("节点{}已上报,无法复制数据,请重新选择", join));
|
|
|
|
+ }
|
|
|
|
+
|
|
//删除原本填写的数据,覆盖
|
|
//删除原本填写的数据,覆盖
|
|
if (removeSqlList.size() > 0) {
|
|
if (removeSqlList.size() > 0) {
|
|
for (String sql : removeSqlList) {
|
|
for (String sql : removeSqlList) {
|
|
@@ -486,7 +526,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
//复制附件信息
|
|
//复制附件信息
|
|
for (WbsTreeContract sourceDataObj : tableList) {
|
|
for (WbsTreeContract sourceDataObj : tableList) {
|
|
- if (sourceDataObj.getTabFileType() == 2) {
|
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(sourceDataObj.getTabFileType()) && sourceDataObj.getTabFileType() == 2) {
|
|
//获取源表中的附件信息
|
|
//获取源表中的附件信息
|
|
String sql = "select * from m_table_file where is_deleted = 0 and type = 2 and tab_id =" + sourceDataObj.getPKeyId();
|
|
String sql = "select * from m_table_file where is_deleted = 0 and type = 2 and tab_id =" + sourceDataObj.getPKeyId();
|
|
List<TableFile> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFile.class));
|
|
List<TableFile> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFile.class));
|
|
@@ -502,8 +542,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
//新增源数据附件到复制节点下对应表中
|
|
//新增源数据附件到复制节点下对应表中
|
|
tableFileClient.saveBatchFile(query, next.getPKeyId());
|
|
tableFileClient.saveBatchFile(query, next.getPKeyId());
|
|
|
|
|
|
- //修改复制节点下对应表的按钮状态
|
|
|
|
- String updateStatus = "update m_wbs_tree_contract set tab_file_type = " + sourceDataObj.getTabFileType() + " ,is_tab_pdf = " + sourceDataObj.getIsTabPdf() + " ,pdf_url = '" + sourceDataObj.getPdfUrl() + "' ,is_buss_show = " + sourceDataObj.getIsBussShow() + " where p_key_id = " + next.getPKeyId();
|
|
|
|
|
|
+ //修改复制节点下对应表的文件上传的按钮状态
|
|
|
|
+ String updateStatus = "update m_wbs_tree_contract set tab_file_type = " + sourceDataObj.getTabFileType() + " where p_key_id = " + next.getPKeyId();
|
|
jdbcTemplate.execute(updateStatus);
|
|
jdbcTemplate.execute(updateStatus);
|
|
|
|
|
|
iterator.remove();
|
|
iterator.remove();
|
|
@@ -512,7 +552,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return R.data(true);
|
|
return R.data(true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1310,7 +1349,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + node.getContractId() + "' and (id = '" + node.getId() + "' or old_id = '" + node.getId() + "')";
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + node.getContractId() + "' and (id = '" + node.getId() + "' or old_id = '" + node.getId() + "')";
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
- Integer max=1;
|
|
|
|
|
|
+ Integer max = 1;
|
|
if (collect.size() > 0) {
|
|
if (collect.size() > 0) {
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
} else {
|
|
} else {
|
|
@@ -1363,7 +1402,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
|
|
newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
|
|
|
|
|
|
//划分编号
|
|
//划分编号
|
|
- newData.setPartitionCode(StringUtils.isNotEmpty(node.getPartitionCode()) ? node.getPartitionCode() : null);
|
|
|
|
|
|
+ newData.setPartitionCode(StringUtils.isNotEmpty(copyBatch.getPartitionCode()) ? copyBatch.getPartitionCode() : null);
|
|
}
|
|
}
|
|
//设置父节点ID
|
|
//设置父节点ID
|
|
if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
|
|
if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
|
|
@@ -1391,7 +1430,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + node.getContractId() + "' and (id = '" + node.getId() + "' or old_id = '" + node.getId() + "')";
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + node.getContractId() + "' and (id = '" + node.getId() + "' or old_id = '" + node.getId() + "')";
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
- Integer max=1;
|
|
|
|
|
|
+ Integer max = 1;
|
|
if (collect.size() > 0) {
|
|
if (collect.size() > 0) {
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
} else {
|
|
} else {
|
|
@@ -1697,10 +1736,18 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
//保存操作记录
|
|
//保存操作记录
|
|
List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
|
|
List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
|
|
-
|
|
|
|
|
|
+ //获取当前节点的所有父节点
|
|
|
|
+ List<WbsTreeContract> result = new ArrayList<>();
|
|
|
|
+ result.add(removeNode);
|
|
|
|
+ this.queryParentNode(removeNode, result);
|
|
|
|
+ StringBuilder pathName = new StringBuilder();
|
|
|
|
+ for (int i = 1, l = result.size(); i <= l; i++) {
|
|
|
|
+ WbsTreeContract node = result.get(result.size() - i);
|
|
|
|
+ pathName.append("-").append(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
|
+ }
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
json.put("operationObjIds", idArray);
|
|
json.put("operationObjIds", idArray);
|
|
- json.put("operationObjName", nodeName);
|
|
|
|
|
|
+ json.put("operationObjName", pathName.substring(1));
|
|
this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", json);
|
|
this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", json);
|
|
|
|
|
|
//保存进回收站
|
|
//保存进回收站
|
|
@@ -1833,7 +1880,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + treeContract.getContractId() + "' and (id = '" + half.getId() + "' or old_id = '" + half.getId() + "')";
|
|
String sql = "select sort from m_wbs_tree_contract where contract_id = '" + treeContract.getContractId() + "' and (id = '" + half.getId() + "' or old_id = '" + half.getId() + "')";
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
|
|
- Integer max =1 ;
|
|
|
|
|
|
+ Integer max = 1;
|
|
if (collect.size() > 0) {
|
|
if (collect.size() > 0) {
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
max = collect.stream().reduce(collect.get(0), Integer::max);
|
|
} else {
|
|
} else {
|
|
@@ -1912,7 +1959,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
if (saveList.size() > 0) {
|
|
if (saveList.size() > 0) {
|
|
//保存施工日志
|
|
//保存施工日志
|
|
if (saveLedger.size() > 0) {
|
|
if (saveLedger.size() > 0) {
|
|
- this.constructionLedgerService.saveBatch(saveLedger,1000);
|
|
|
|
|
|
+ this.constructionLedgerService.saveBatch(saveLedger, 1000);
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -2287,7 +2334,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
contractIds.add(contractIdRelation);
|
|
contractIds.add(contractIdRelation);
|
|
}
|
|
}
|
|
if (contractIds.size() > 0) {
|
|
if (contractIds.size() > 0) {
|
|
- //原始classify=2时查不出数量统计,所以改成传1
|
|
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
//子节点
|
|
//子节点
|
|
rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
|
|
rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
|