|
@@ -20,7 +20,6 @@ import cn.hutool.core.date.StopWatch;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.aliyun.oss.ServiceException;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -40,6 +39,7 @@ import org.springblade.business.vo.SaveContractLogVO;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -342,7 +342,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
});
|
|
|
stopWatch.start("公式处理");
|
|
|
List<Formula> formulas = this.formulaService.getFormulaList(keyMappers);
|
|
|
- WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId,nodeId));
|
|
|
+ WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
|
TableElementConverter tec = new TableElementConverter(tableInfoList, keyMappers, formulas, coordinateMap, wtc);
|
|
|
if (tec.isPresent()) {
|
|
|
tec.before();
|
|
@@ -530,11 +530,11 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public R saveOrUpdateInfo(List<TableInfo> tableInfoList){
|
|
|
+ public R saveOrUpdateInfo(List<TableInfo> tableInfoList) {
|
|
|
|
|
|
if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
//施工资料填报
|
|
|
- String pkids="";
|
|
|
+ String pkids = "";
|
|
|
try {
|
|
|
for (TableInfo tableInfo : tableInfoList) {
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -542,7 +542,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (wbsTreeContract == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- pkids+=tableInfo.getPkeyId()+",";
|
|
|
+ pkids += tableInfo.getPkeyId() + ",";
|
|
|
String tabName = wbsTreeContract.getInitTableName();
|
|
|
// 判读修改还是 添加
|
|
|
String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId();
|
|
@@ -594,7 +594,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("operationObjIds", Func.toStrList(pkids));
|
|
|
- json.put("operationObjName", wbsTreeContractByP.getNodeName()+"节点数据操作");
|
|
|
+ json.put("operationObjName", wbsTreeContractByP.getNodeName() + "节点数据操作");
|
|
|
|
|
|
//保存操作记录
|
|
|
this.operationLogClient.saveUserOperationLog(1, "资料填报", "工序填报页面", json);
|
|
@@ -606,50 +606,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.fail("操作成功");
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void saveOrUpdateInfoTrial(List<TableInfo> tableInfoList) throws SQLException {
|
|
|
- //试验填报
|
|
|
- if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
- try {
|
|
|
- for (TableInfo tableInfo : tableInfoList) {
|
|
|
- WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
- .eq(WbsTreePrivate::getPKeyId, tableInfo.getPkeyId()));
|
|
|
- if (wbsTreePrivate == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- String tabName = wbsTreePrivate.getInitTableName();
|
|
|
- // 判读修改还是 添加
|
|
|
- String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId();
|
|
|
- jdbcTemplate.execute(delSql);
|
|
|
-
|
|
|
- String sqlInfo = "";
|
|
|
- LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
- sqlInfo = "INSERT INTO " + tabName + " ( ";
|
|
|
- String keyStr = "id,";
|
|
|
- String valStr = SnowFlakeUtil.getId() + ",";
|
|
|
- for (String keys : dataMap2.keySet()) {
|
|
|
- keyStr += keys + ",";
|
|
|
- valStr += "'" + dataMap2.get(keys) + "',";
|
|
|
- }
|
|
|
- keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
|
|
|
- valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
- sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
|
|
|
-
|
|
|
- UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.in("p_key_id", tableInfo.getPkeyId());
|
|
|
- updateWrapper.set("is_tab_pdf", 2);
|
|
|
- wbsTreePrivateService.update(updateWrapper);
|
|
|
- jdbcTemplate.execute(sqlInfo);
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// 获取用户
|
|
|
@Override
|
|
|
public Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException {
|
|
@@ -707,9 +663,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
String pdfPath = file_path + "/pdf//" + pkeyId + ".pdf";
|
|
|
String excelPath = file_path + "/pdf//" + pkeyId + ".xlsx";
|
|
|
- File tabpdf = ResourceUtil.getFile(pdfPath);
|
|
|
- if (tabpdf.exists()) {
|
|
|
- tabpdf.delete();
|
|
|
+ File tabPdf = ResourceUtil.getFile(pdfPath);
|
|
|
+ if (tabPdf.exists()) {
|
|
|
+ tabPdf.delete();
|
|
|
}
|
|
|
|
|
|
// 获取清表信息
|
|
@@ -905,16 +861,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getIsDeleted, 0));
|
|
|
tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
|
|
|
-
|
|
|
List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && (tableFile.getType() == 1 || tableFile.getType() == 2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
|
|
|
|
|
|
- File tabpdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
- if (tabpdf2.exists()) {
|
|
|
- tabpdf2.delete();
|
|
|
-
|
|
|
+ File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
+ if (tabPdf2.exists()) {
|
|
|
+ tabPdf2.delete();
|
|
|
}
|
|
|
+
|
|
|
FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
|
|
|
BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
@@ -927,7 +882,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.data(bladeFile2.getLink());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public R getBussDataInfo(Long pkeyId) {
|
|
|
|
|
@@ -939,9 +893,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.data(reData);
|
|
|
}
|
|
|
|
|
|
- if (wbsTreeContract == null) {
|
|
|
- return R.data(reData);
|
|
|
- }
|
|
|
if (wbsTreeContract.getHtmlUrl() == null) {
|
|
|
return R.data(reData);
|
|
|
}
|
|
@@ -949,17 +900,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//表单是否存储在
|
|
|
String tabName = wbsTreeContract.getInitTableName();
|
|
|
String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
- List<Map<String, Object>> tablist = jdbcTemplate.queryForList(isExitSql);
|
|
|
- if (tablist == null || tablist.size() <= 0) {
|
|
|
+ List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
|
|
|
+ if (tabList == null || tabList.size() <= 0) {
|
|
|
return R.fail("无实体表对应");
|
|
|
}
|
|
|
|
|
|
String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId;
|
|
|
List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
|
|
|
-
|
|
|
// 匹配关联
|
|
|
-
|
|
|
try {
|
|
|
File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
@@ -1010,7 +959,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (dataIn != null && dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
@@ -1132,6 +1080,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
jdbcTemplate.execute(sql);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 试验 单pdf
|
|
|
+ */
|
|
|
@Override
|
|
|
public String getBussPDFTrial(TableInfo tableInfo, Long pkeyId, String contractId) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
@@ -1155,7 +1106,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
ExcelTab excelTab = this.getById(wbsTreePrivate.getExcelId());
|
|
|
|
|
|
if (excelTab == null) {
|
|
|
- throw new ServiceException("操作失败");
|
|
|
+ throw new ServiceException("操作失败!");
|
|
|
}
|
|
|
|
|
|
Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
|
|
@@ -1359,6 +1310,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return bladeFile2.getLink();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 试验 多pdf
|
|
|
+ */
|
|
|
@Override
|
|
|
public String getBussPDFSTrial(String nodeId, Integer tableType, String classify, String contractId, String projectId) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
@@ -1401,4 +1355,51 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return bladeFile.getLink();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 试验 修改信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void saveOrUpdateInfoTrial(List<TableInfo> tableInfoList) throws SQLException {
|
|
|
+ //试验填报
|
|
|
+ if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
+ try {
|
|
|
+ for (TableInfo tableInfo : tableInfoList) {
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, tableInfo.getPkeyId()));
|
|
|
+ if (wbsTreePrivate == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String tabName = wbsTreePrivate.getInitTableName();
|
|
|
+ // 判读修改还是 添加
|
|
|
+ String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId();
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+
|
|
|
+ String sqlInfo = "";
|
|
|
+ LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
+ sqlInfo = "INSERT INTO " + tabName + " ( ";
|
|
|
+ String keyStr = "id,";
|
|
|
+ String valStr = SnowFlakeUtil.getId() + ",";
|
|
|
+ for (String keys : dataMap2.keySet()) {
|
|
|
+ keyStr += keys + ",";
|
|
|
+ valStr += "'" + dataMap2.get(keys) + "',";
|
|
|
+ }
|
|
|
+ keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
|
|
|
+ valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
+ sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
|
|
|
+
|
|
|
+ UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id", tableInfo.getPkeyId());
|
|
|
+ updateWrapper.set("is_tab_pdf", 2);
|
|
|
+ wbsTreePrivateService.update(updateWrapper);
|
|
|
+ jdbcTemplate.execute(sqlInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|