|
@@ -87,6 +87,7 @@ import java.text.SimpleDateFormat;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -326,7 +327,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- dataMap2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
|
|
|
+ dataInfo2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
|
+ dataInfo2.put("classify",tableInfo.getClassify());
|
|
|
|
+ dataInfo2.put("contractId",tableInfo.getContractId());
|
|
|
|
+ dataInfo2.put("projectId",tableInfo.getProjectId());
|
|
tableInfo.setDataMap(dataMap2);
|
|
tableInfo.setDataMap(dataMap2);
|
|
result.add(tableInfo);
|
|
result.add(tableInfo);
|
|
}
|
|
}
|
|
@@ -1237,33 +1241,36 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public R getBussDataInfo(Long pkeyId, int type) {
|
|
|
|
|
|
+ public Map<String,Object> getBussDataInfo(Long pkeyId, int type) {
|
|
return this.getBussDataInfo(pkeyId,type,true);
|
|
return this.getBussDataInfo(pkeyId,type,true);
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
- public R getBussDataInfo(Long pkeyId, int type,Boolean isFormLoading) {
|
|
|
|
|
|
+ public Map<String,Object> getBussDataInfo(Long pkeyId, int type,Boolean isFormLoading) {
|
|
Document document=null;
|
|
Document document=null;
|
|
Map<String, Object> reData = new HashMap<>();
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
if (wbsTreeContract == null) {
|
|
if (wbsTreeContract == null) {
|
|
- return R.data(reData);
|
|
|
|
|
|
+ return reData;
|
|
}
|
|
}
|
|
|
|
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
- return R.data(reData);
|
|
|
|
|
|
+ return reData;
|
|
}
|
|
}
|
|
|
|
|
|
//表单是否存储在
|
|
//表单是否存储在
|
|
- String tabName = wbsTreeContract.getInitTableName();
|
|
|
|
|
|
+ /* String tabName = wbsTreeContract.getInitTableName();
|
|
String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
|
|
List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
|
|
if (tabList == null || tabList.size() <= 0) {
|
|
if (tabList == null || tabList.size() <= 0) {
|
|
- return R.fail("无实体表对应");
|
|
|
|
|
|
+ return reData;
|
|
}
|
|
}
|
|
|
|
|
|
- String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId;
|
|
|
|
|
|
+ String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId;*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String querySql = "select * from table_data_info where p_key_id=" + pkeyId;
|
|
List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
|
|
|
// 匹配关联
|
|
// 匹配关联
|
|
@@ -1396,6 +1403,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
|
|
|
|
if (dataIn != null && dataIn.size() >= 1) {
|
|
if (dataIn != null && dataIn.size() >= 1) {
|
|
|
|
+ for (Map<String, Object> data : dataIn) {
|
|
|
|
+ reData.put(data.get("tab_key")+"",data.get("key_val"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*if (dataIn != null && dataIn.size() >= 1) {
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
for (String key : mysqlData.keySet()) {
|
|
for (String key : mysqlData.keySet()) {
|
|
String tabVal = mysqlData.get(key) + "";
|
|
String tabVal = mysqlData.get(key) + "";
|
|
@@ -1460,7 +1473,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
// 获取默认值
|
|
// 获取默认值
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
@@ -1494,7 +1507,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
if(!isFormLoading) {
|
|
if(!isFormLoading) {
|
|
this.formulaService.paramFormula(wbsTreeContract, reData, document);
|
|
this.formulaService.paramFormula(wbsTreeContract, reData, document);
|
|
}
|
|
}
|
|
- return R.data(reData);
|
|
|
|
|
|
+ return reData;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1525,7 +1538,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
return R.fail("未获取到清表信息");
|
|
return R.fail("未获取到清表信息");
|
|
}
|
|
}
|
|
|
|
|
|
- Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId, 0).getData();
|
|
|
|
|
|
+ Map<String, Object> DataInfo = getBussDataInfo(pkeyId, 0);
|
|
//真实填报率
|
|
//真实填报率
|
|
Integer realFillRate = 0;
|
|
Integer realFillRate = 0;
|
|
|
|
|
|
@@ -1631,6 +1644,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
realFillRate = v.intValue();
|
|
realFillRate = v.intValue();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
Elements trs = table.select("tr");
|
|
Elements trs = table.select("tr");
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
for (String val : DataInfo.keySet()) {
|
|
for (String val : DataInfo.keySet()) {
|
|
@@ -1886,6 +1900,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
// 获取有权限的节点信息
|
|
// 获取有权限的节点信息
|
|
List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId,null);
|
|
List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId,null);
|
|
List<String> data = new ArrayList<>();
|
|
List<String> data = new ArrayList<>();
|
|
|
|
+ if(nodeId.indexOf(":")>=0){
|
|
|
|
+ nodeId = nodeId.split(":")[0];
|
|
|
|
+ }
|
|
if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
|
|
if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
|
|
for (WbsTreeContract wbsInfo : wbsTreeContractList) {
|
|
for (WbsTreeContract wbsInfo : wbsTreeContractList) {
|
|
// 隐藏的不生成pdf
|
|
// 隐藏的不生成pdf
|
|
@@ -2938,11 +2955,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
String contractId = tableInfo1.getString("contractId");
|
|
String contractId = tableInfo1.getString("contractId");
|
|
String projectId = tableInfo1.getString("projectId");
|
|
String projectId = tableInfo1.getString("projectId");
|
|
String classify = tableInfo1.getString("classify");
|
|
String classify = tableInfo1.getString("classify");
|
|
|
|
+ String UserId = AuthUtil.getUserId()+"";
|
|
|
|
+ RedisTemplate.opsForValue().set("pdf-" + nodeId+"-"+classify, "1", 300, TimeUnit.SECONDS);
|
|
//构造阻塞器
|
|
//构造阻塞器
|
|
CountDownLatch cdl = new CountDownLatch(dataArray.size());
|
|
CountDownLatch cdl = new CountDownLatch(dataArray.size());
|
|
// 构造多线程保存用户数据到表中 并生成excel
|
|
// 构造多线程保存用户数据到表中 并生成excel
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
JSONObject jsonObject = dataArray.getJSONObject(i);
|
|
JSONObject jsonObject = dataArray.getJSONObject(i);
|
|
|
|
+ jsonObject.put("UserId",UserId);
|
|
Thread countUserThread = new Thread(() -> {
|
|
Thread countUserThread = new Thread(() -> {
|
|
try {
|
|
try {
|
|
SaveOneTabInfo(jsonObject);
|
|
SaveOneTabInfo(jsonObject);
|
|
@@ -2953,18 +2973,34 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
});
|
|
});
|
|
countUserThread.start();
|
|
countUserThread.start();
|
|
|
|
+
|
|
|
|
+ new Thread(() -> {
|
|
|
|
+ try {
|
|
|
|
+ cdl.await();
|
|
|
|
+ //合并pdf加载
|
|
|
|
+ this.getBussPdfs(nodeId+":"+UserId, classify, contractId, projectId);
|
|
|
|
+ //更新缓存
|
|
|
|
+ informationQueryClient.delAsyncWbsTree(contractId);
|
|
|
|
+ RedisTemplate.delete("pdf-" + nodeId+"-"+classify);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ cdl.countDown();//标记已经完成一个任务
|
|
|
|
+ }
|
|
|
|
+ }).start();
|
|
}
|
|
}
|
|
- //合并pdf加载
|
|
|
|
- this.getBussPdfs(nodeId, classify, contractId, projectId);
|
|
|
|
- //更新缓存
|
|
|
|
- informationQueryClient.delAsyncWbsTree(contractId);
|
|
|
|
return R.data("操作成功");
|
|
return R.data("操作成功");
|
|
}
|
|
}
|
|
|
|
|
|
// 保存单表
|
|
// 保存单表
|
|
public void SaveOneTabInfo(JSONObject tableInfo) throws Exception {
|
|
public void SaveOneTabInfo(JSONObject tableInfo) throws Exception {
|
|
System.out.println("---------=" + new Date().toLocaleString());
|
|
System.out.println("---------=" + new Date().toLocaleString());
|
|
- String pKeyId = tableInfo.getString("pkeyId");
|
|
|
|
|
|
+ String pKeyId = tableInfo.getString("p_key_id");
|
|
|
|
+ String nodeId = tableInfo.getString("nodeId");
|
|
|
|
+ String classify = tableInfo.getString("classify");
|
|
|
|
+ String UserId = tableInfo.getString("UserId");
|
|
|
|
+ //真实填报率
|
|
|
|
+ Integer realFillRate = 0;
|
|
|
|
|
|
tableInfo.fluentRemove("contractId")
|
|
tableInfo.fluentRemove("contractId")
|
|
.fluentRemove("pkeyId")
|
|
.fluentRemove("pkeyId")
|
|
@@ -3018,6 +3054,31 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
|
|
+
|
|
|
|
+ //计算填报率
|
|
|
|
+ List<String> keyList = table.getElementsByAttribute("v-model").stream()
|
|
|
|
+ .map(l -> {
|
|
|
|
+ String attr = l.attr("v-model");
|
|
|
|
+ System.out.println(attr);
|
|
|
|
+ String[] split = attr.split("\\.");
|
|
|
|
+ return split[1];
|
|
|
|
+ })
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ Long sigSize = table.getElementsByAttribute(":readonly").stream().count();
|
|
|
|
+ int keySize = keyList.size();
|
|
|
|
+ List<String> fills = tableInfo.keySet().stream().filter(e -> StringUtils.isNotEmpty(tableInfo.getString(e)) && e.contains("__") && e.contains("key")).collect(Collectors.toList());
|
|
|
|
+ if (fills.size() != 0 && keyList != null && keyList.size() != 0){
|
|
|
|
+ if (keySize == sigSize){
|
|
|
|
+ realFillRate = 100;
|
|
|
|
+ }else if (keySize > sigSize) {
|
|
|
|
+ keySize = keySize - sigSize.intValue();
|
|
|
|
+ keyList.retainAll(fills);
|
|
|
|
+ Double v = new Double(keyList.size()) / new Double(keySize) * 100;
|
|
|
|
+ realFillRate = v.intValue();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
if (ObjectUtil.isNotEmpty(tableInfo)) {
|
|
if (ObjectUtil.isNotEmpty(tableInfo)) {
|
|
for (String key : tableInfo.keySet()) {
|
|
for (String key : tableInfo.keySet()) {
|
|
if (key.contains("key") && key.contains("__")) {
|
|
if (key.contains("key") && key.contains("__")) {
|
|
@@ -3220,8 +3281,20 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
throw new RuntimeException("字段过长,新增失败");
|
|
throw new RuntimeException("字段过长,新增失败");
|
|
}
|
|
}
|
|
|
|
|
|
- String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
|
|
|
+ String fileName ="暂无文件提名1";
|
|
|
|
+ // 处理文件提名
|
|
|
|
+ try {
|
|
|
|
+ WbsTreeContract wbsTreeContractByP = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
|
|
+ //处理文件提名
|
|
|
|
+ fileName = this.wbsParamService.createFileTitle(wbsTreeContractByP);
|
|
|
|
+ }catch (Exception exception){
|
|
|
|
+
|
|
|
|
+ }finally {
|
|
|
|
+ //huangjn 保存成功后调用生成资料查询列表数据
|
|
|
|
+ this.informationQueryClient.saveOrUpdateInformationQueryData(nodeId+":"+UserId, "首件使用字段", "业务ID(主要将来给首件使用)", fileName, Integer.parseInt(classify), 2, "false", "源文件(首件字段)", "pdf文件(首件字段)", "首件上传总结报告名称", new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
String pdfPath = file_path + "/pdf//" + pKeyId + ".pdf";
|
|
String pdfPath = file_path + "/pdf//" + pKeyId + ".pdf";
|
|
String excelPath = file_path + "/pdf//" + pKeyId + ".xlsx";
|
|
String excelPath = file_path + "/pdf//" + pKeyId + ".xlsx";
|
|
|
|
|
|
@@ -3286,10 +3359,11 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.in("p_key_id", pKeyId + "");
|
|
updateWrapper.in("p_key_id", pKeyId + "");
|
|
updateWrapper.set("pdf_url", fileUrl);
|
|
updateWrapper.set("pdf_url", fileUrl);
|
|
|
|
+ updateWrapper.set("real_fill_rate", realFillRate);
|
|
|
|
+ updateWrapper.set("is_tab_pdf", 2);
|
|
wbsTreeContractService.update(updateWrapper);
|
|
wbsTreeContractService.update(updateWrapper);
|
|
tabPdf2.delete();
|
|
tabPdf2.delete();
|
|
tabPdf.delete();
|
|
tabPdf.delete();
|
|
- ResourceUtil.getFile(excelPath);
|
|
|
|
//关闭流
|
|
//关闭流
|
|
IoUtil.closeQuietly(outputStream);
|
|
IoUtil.closeQuietly(outputStream);
|
|
IoUtil.closeQuietly(exceInp);
|
|
IoUtil.closeQuietly(exceInp);
|