|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
|
import com.mixsmart.utils.ListUtils;
|
|
|
import com.mixsmart.utils.RegexUtils;
|
|
@@ -33,7 +34,9 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
+import org.jsoup.nodes.Entities;
|
|
|
import org.jsoup.nodes.Node;
|
|
|
+import org.jsoup.parser.Parser;
|
|
|
import org.jsoup.select.Elements;
|
|
|
import org.springblade.business.dto.TrialSeleInspectionRecordBaseInfoDTO;
|
|
|
import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
|
|
@@ -45,6 +48,7 @@ import org.springblade.business.feign.TrialSelfInspectionRecordClient;
|
|
|
import org.springblade.business.vo.SaveContractLogVO;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
+import org.springblade.manager.util.DataStructureFormatUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.common.vo.DataVO;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
@@ -54,7 +58,6 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
-import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
@@ -72,15 +75,14 @@ import org.springblade.manager.mapper.ExcelTabMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.utils.*;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
+import org.springblade.manager.wrapper.ExcelTabWrapper;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.dao.DataAccessException;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.jdbc.core.RowCallbackHandler;
|
|
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -92,7 +94,6 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
-import java.nio.file.Files;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -135,9 +136,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
private final TableInfoServiceImpl tableInfoService;
|
|
|
private final INodeBaseInfoService nodeBaseInfoService;
|
|
|
private final TrialSelfInspectionRecordClient trialSelfInspectionRecordClient;
|
|
|
+ private final WbsTreeContractOldHtmlService wbsTreeContractOldHtmlService;
|
|
|
+
|
|
|
// excel 解析结构
|
|
|
private final IExctabCellService exctabCellService;
|
|
|
- private final WbsTreeContractOldHtmlService wbsTreeContractOldHtmlService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@@ -145,7 +147,79 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
@Override
|
|
|
public IPage<ExcelTabVO> selectExcelTabPage(IPage<ExcelTabVO> page, ExcelTabVO excelTab) {
|
|
|
- return page.setRecords(baseMapper.selectExcelTabPage(page, excelTab));
|
|
|
+ if (excelTab.getProjectId() != null && excelTab.getProjectId() > 0 && (excelTab.getParentId() == null || excelTab.getParentId() == 0)) {
|
|
|
+ List<ExcelTabVO> records = baseMapper.selectRootExcelTab(page, excelTab.getProjectId(), null);
|
|
|
+ if (!records.isEmpty()) {
|
|
|
+ List<Long> ids = records.stream().map(ExcelTabVO::getId).collect(Collectors.toList());
|
|
|
+ List<ExcelTabVO> excelTabs = this.baseMapper.getByIds(ids);
|
|
|
+ Map<Long, ExcelTabVO> map = excelTabs.stream().collect(toMap(ExcelTabVO::getId, v -> v));
|
|
|
+ records.forEach(v -> {
|
|
|
+ ProjectInfoVO1 projectInfoVO1 = new ProjectInfoVO1();
|
|
|
+ projectInfoVO1.setProjectId(v.getProjectId());
|
|
|
+ projectInfoVO1.setProjectName(v.getProjectName());
|
|
|
+ if (map.get(v.getId()) != null) {
|
|
|
+ BeanUtil.copyProperties(map.get(v.getId()), v);
|
|
|
+ }
|
|
|
+ v.setProjectInfoList(Collections.singletonList(projectInfoVO1));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return page.setRecords(records);
|
|
|
+ }
|
|
|
+ List<ExcelTabVO> records = baseMapper.selectExcelTabPage(page, excelTab);
|
|
|
+ if (!records.isEmpty() && (excelTab.getParentId() == null || excelTab.getParentId() == 0)) {
|
|
|
+ Set<Long> set = records.stream().map(ExcelTabVO::getId).collect(Collectors.toSet());
|
|
|
+ List<ExcelTabVO> projectInfoList = baseMapper.selectRootExcelTab(new Page<>(), null, set);
|
|
|
+ Map<Long, List<ExcelTabVO>> collect = projectInfoList.stream().collect(Collectors.groupingBy(ExcelTabVO::getId));
|
|
|
+ records.forEach(v -> {
|
|
|
+ List<ExcelTabVO> excelTabVOS = collect.get(v.getId());
|
|
|
+ if (excelTabVOS != null) {
|
|
|
+ List<ProjectInfoVO1> list = excelTabVOS.stream().map(vo -> {
|
|
|
+ ProjectInfoVO1 projectInfoVO1 = new ProjectInfoVO1();
|
|
|
+ projectInfoVO1.setProjectId(vo.getProjectId());
|
|
|
+ projectInfoVO1.setProjectName(vo.getProjectName());
|
|
|
+ return projectInfoVO1;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ v.setProjectInfoList(list);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return page.setRecords(records);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExcelTabVO templateDetail(Long id) {
|
|
|
+ List<ExcelTabVO> excelTabVOs = this.baseMapper.getByIds(Collections.singleton(id));
|
|
|
+ if (excelTabVOs == null || excelTabVOs.isEmpty()) {
|
|
|
+ return new ExcelTabVO();
|
|
|
+ }
|
|
|
+ ExcelTabVO excelTabVO = excelTabVOs.get(0);
|
|
|
+ if (excelTabVO == null || (excelTabVO.getParentId() != null && excelTabVO.getParentId() > 0)) {
|
|
|
+ return excelTabVO;
|
|
|
+ }
|
|
|
+ Map<String, Object> map = jdbcTemplate.queryForMap("SELECT count(a.id) as total,count(t.id) as useNum from m_excel_tab a LEFT JOIN ( select excel_id as id from m_wbs_tree_private where type = 2 and is_deleted = 0 and excel_id is not null GROUP BY excel_id ) as t " +
|
|
|
+ "on a.id = t.id where a.is_deleted = 0 and file_type = 3 and alias like '" + id + "%'");
|
|
|
+ if (map.get("total") == null) {
|
|
|
+ excelTabVO.setTabCout(0);
|
|
|
+ } else {
|
|
|
+ excelTabVO.setTabCout(Integer.parseInt(map.get("total").toString()));
|
|
|
+ }
|
|
|
+ if (map.get("useNum") == null) {
|
|
|
+ excelTabVO.setExcelUseNumber(0);
|
|
|
+ } else {
|
|
|
+ excelTabVO.setExcelUseNumber(Integer.parseInt(map.get("useNum").toString()));
|
|
|
+ }
|
|
|
+ List<ExcelTabVO> projectInfoList = baseMapper.selectRootExcelTab(new Page<>(), null, Collections.singleton(id));
|
|
|
+ if (projectInfoList != null && !projectInfoList.isEmpty()) {
|
|
|
+ List<ProjectInfoVO1> list = projectInfoList.stream().map(vo -> {
|
|
|
+ ProjectInfoVO1 projectInfoVO1 = new ProjectInfoVO1();
|
|
|
+ projectInfoVO1.setProjectId(vo.getProjectId());
|
|
|
+ projectInfoVO1.setProjectName(vo.getProjectName());
|
|
|
+ return projectInfoVO1;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ excelTabVO.setProjectInfoList(list);
|
|
|
+ excelTabVO.setProjectUseNumber(list.size());
|
|
|
+ }
|
|
|
+ return excelTabVO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -738,19 +812,20 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String tabName = tableNode.getInitTableName();
|
|
|
|
|
|
//拼接SQL
|
|
|
- StringBuilder sql = new StringBuilder("INSERT INTO " + tabName),
|
|
|
- keySql = new StringBuilder("id, group_id"),
|
|
|
- valSql = new StringBuilder("" + tableInfo.getBusinessId() + ", " + tableInfo.getPkeyId());
|
|
|
+// StringBuilder sql = new StringBuilder("INSERT INTO " + tabName),
|
|
|
+// keySql = new StringBuilder("id, group_id"),
|
|
|
+// valSql = new StringBuilder("" + tableInfo.getBusinessId() + ", " + tableInfo.getPkeyId());
|
|
|
|
|
|
//参数
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
- updateFieldLength(tabName, dataMap2);
|
|
|
- for (String key : dataMap2.keySet()) {
|
|
|
- keySql.append(", ").append(key);
|
|
|
- valSql.append(", '").append(dataMap2.get(key)).append("'");
|
|
|
- }
|
|
|
-
|
|
|
- sql.append("(").append(keySql).append(")").append(" values(").append(valSql).append(")");
|
|
|
+ dataMap2.remove("p_key_id");
|
|
|
+ StringBuilder sql = buildMTableInsertSql(tabName, dataMap2, tableInfo.getBusinessId(), tableInfo.getPkeyId(), null);
|
|
|
+// for (String key : dataMap2.keySet()) {
|
|
|
+// keySql.append(", ").append(key);
|
|
|
+// valSql.append(", '").append(dataMap2.get(key)).append("'");
|
|
|
+// }
|
|
|
+//
|
|
|
+// sql.append("(").append(keySql).append(")").append(" values(").append(valSql).append(")");
|
|
|
|
|
|
//新增数据
|
|
|
try {
|
|
@@ -1015,19 +1090,43 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements td = table.select("td");
|
|
|
- Set<String> set = new HashSet<>();
|
|
|
+ Map<String, String> set = new HashMap<>();
|
|
|
for (Element element : td) {
|
|
|
if (element.childNodes().size() >= 2) {
|
|
|
String title = element.childNodes().get(1).attr("placeholder");
|
|
|
if (StringUtils.isNotBlank(title)) {
|
|
|
- set.add(title);
|
|
|
+ if (title.contains("&")) {
|
|
|
+ // 处理 < 之类的转义字符
|
|
|
+ if (title.contains("&")) {
|
|
|
+ title = Parser.unescapeEntities(title, false);
|
|
|
+ }
|
|
|
+ title = Parser.unescapeEntities(title, false);
|
|
|
+ }
|
|
|
+ set.put(title, title);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//获取未匹配的字段
|
|
|
List<WbsFormElement> list = new ArrayList<>();
|
|
|
if (set != null && set.size() > 0) {
|
|
|
- list = baseMapper.getUnMatchField(tabId, set);
|
|
|
+// list = baseMapper.getUnMatchField(tabId, set);
|
|
|
+ List<WbsFormElement> elements = jdbcTemplate.query("select * from m_wbs_form_element where f_id = ? and is_deleted = 0", new Object[]{tabId}, new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
+ elements.forEach(wbsFormElement -> {
|
|
|
+ String name = wbsFormElement.getEName();
|
|
|
+ if (StringUtils.isNotBlank(name)) {
|
|
|
+ if (name.contains("&")) {
|
|
|
+ // 处理 < 之类的转义字符
|
|
|
+ if (name.contains("&")) {
|
|
|
+ name = Parser.unescapeEntities(name, false);
|
|
|
+ }
|
|
|
+ name = Parser.unescapeEntities(name, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (set.containsKey(name)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ list.add(wbsFormElement);
|
|
|
+ });
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -1116,18 +1215,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
for (TableInfo tableInfo : tableInfoList) {
|
|
|
//获取字段信息
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
- updateFieldLength(table.getTabEnName(),dataMap2);
|
|
|
- //拼接SQL
|
|
|
- StringBuilder sql = new StringBuilder("INSERT INTO " + table.getTabEnName()),
|
|
|
- keySql = new StringBuilder("id, group_id"),
|
|
|
- valSql = new StringBuilder("" + SnowFlakeUtil.getId() + ", " + firstId);
|
|
|
-
|
|
|
- for (String key : dataMap2.keySet()) {
|
|
|
- keySql.append(", ").append(key);
|
|
|
- valSql.append(", '").append(dataMap2.get(key)).append("'");
|
|
|
- }
|
|
|
-
|
|
|
- sql.append("(").append(keySql).append(")").append(" values(").append(valSql).append(")");
|
|
|
+ StringBuilder sql = buildMTableInsertSql(table.getTabEnName(), dataMap2, SnowFlakeUtil.getId(), firstId, null);
|
|
|
+// // 拼接SQL
|
|
|
+// StringBuilder sql = new StringBuilder("INSERT INTO " + table.getTabEnName()),
|
|
|
+// keySql = new StringBuilder("id, group_id"),
|
|
|
+// valSql = new StringBuilder("" + SnowFlakeUtil.getId() + ", " + firstId);
|
|
|
+// for (String key : dataMap2.keySet()) {
|
|
|
+// keySql.append(", ").append(key);
|
|
|
+// valSql.append(", '").append(dataMap2.get(key)).append("'");
|
|
|
+// }
|
|
|
+//
|
|
|
+// sql.append("(").append(keySql).append(")").append(" values(").append(valSql).append(")");
|
|
|
|
|
|
//新增数据
|
|
|
try {
|
|
@@ -1244,21 +1342,21 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId();
|
|
|
String sqlInfo = "";
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
- updateFieldLength(tabName, dataMap2);
|
|
|
/*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
|
|
|
dataMap2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
+ sqlInfo = buildMTableInsertSql(tabName, dataMap2, SnowFlakeUtil.getId(), null, null).toString();
|
|
|
//统计保存的字段
|
|
|
|
|
|
- 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 + ")";
|
|
|
+// 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 + ")";
|
|
|
|
|
|
WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId, tableInfo.getContractId()));
|
|
@@ -1342,7 +1440,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//保存操作记录
|
|
|
this.operationLogClient.saveUserOperationLog(1, "资料填报", "工序填报页面", json);
|
|
|
// 更新redis
|
|
|
- informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getContractId(), "", "1");
|
|
|
+// informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getContractId(), "", "1");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return R.fail("操作失败");
|
|
@@ -1354,60 +1452,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.data(tableInfoList2);
|
|
|
// return R.success(fileName1);
|
|
|
}
|
|
|
-
|
|
|
- public void updateFieldLength(String tableName, Map<String, String> fieldNameAndLengthMap) {
|
|
|
- if (fieldNameAndLengthMap == null || fieldNameAndLengthMap.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- String fields = fieldNameAndLengthMap.keySet().stream().filter(key -> !key.equals("id") && !key.equals("p_key_id") && !key.equals("group_id")).map(key -> "'" + key + "'").collect(Collectors.joining(","));
|
|
|
- if (fields.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- List<Map<String, Object>> fieldMap = jdbcTemplate.queryForList("select distinct COLUMN_NAME as fieldName, CHARACTER_MAXIMUM_LENGTH as fieldLength from information_schema.COLUMNS where TABLE_NAME = '" + tableName +
|
|
|
- "' and COLUMN_NAME in (" + fields + ")");
|
|
|
- Map<String, Integer> map = fieldMap.stream().collect(toMap(k -> k.get("fieldName") + "", v -> {
|
|
|
- try {
|
|
|
- return Integer.parseInt(v.get("fieldLength") + "");
|
|
|
- } catch (Exception e) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }, Math::max));
|
|
|
-
|
|
|
- List<WbsFormElement> elementList = jdbcTemplate.query("SELECT id,e_key,e_length from m_wbs_form_element WHERE f_id = (SELECT id from m_table_info WHERE tab_en_name = '" + tableName
|
|
|
- +"' and is_deleted = 0 limit 1) and is_deleted = 0 and e_key in ( " + fields + ")", new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- sql.append("alter table ").append(tableName);
|
|
|
- elementList.forEach(element -> {
|
|
|
- String data = fieldNameAndLengthMap.get(element.getEKey());
|
|
|
- Integer fieldLength = map.get(element.getEKey());
|
|
|
- if (data != null && element.getELength() != null && data.length() > fieldLength) {
|
|
|
- int length = data.length();
|
|
|
- // 取整
|
|
|
- length = (length / 10 + 1) * 10;
|
|
|
- if (length < element.getELength()) {
|
|
|
- length = element.getELength();
|
|
|
- element.setELength(null);
|
|
|
- } else {
|
|
|
- element.setELength(length);
|
|
|
- }
|
|
|
- sql.append(" modify column ").append(element.getEKey()).append(" ").append("varchar").append("(").append(length).append("),");
|
|
|
- }
|
|
|
- });
|
|
|
- if (sql.indexOf("modify") > 0) {
|
|
|
- sql.deleteCharAt(sql.length() - 1);
|
|
|
- TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
|
|
|
- try {
|
|
|
- jdbcTemplate.batchUpdate("update m_wbs_form_element set e_length = ? where id = ?", elementList.stream().filter(element -> element.getELength() != null).map(element -> new Object[]{element.getELength(), element.getId()}).collect(Collectors.toList()));
|
|
|
- jdbcTemplate.execute(sql.toString());
|
|
|
- transactionManager1.commit(transactionStatus);
|
|
|
- } catch (Exception e) {
|
|
|
- transactionManager1.rollback(transactionStatus);
|
|
|
- log.error("更新字段长度失败, error: " + e.getMessage());
|
|
|
- throw new ServiceException("字段长度超出限制, 系统无法进行扩容,请尝试缩小字段长度或者联系系统管理员处理");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public String reason(String log) {
|
|
|
/*保存的时候错误提示例如:字段过短提示 yangyj*/
|
|
|
StringBuilder sb = new StringBuilder();
|
|
@@ -1428,6 +1472,103 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
return sb.append("保存异常,请联系管理员").toString();
|
|
|
}
|
|
|
+ public StringBuilder buildMTableInsertSql(String tabName, Map<String, String> dataMap2, Object id, Object groupId, Object pKeyId) {
|
|
|
+ if (dataMap2 == null || dataMap2.isEmpty() || tabName == null || tabName.isEmpty()) {
|
|
|
+ return new StringBuilder();
|
|
|
+ }
|
|
|
+ //拼接SQL
|
|
|
+ StringBuilder sql = new StringBuilder("INSERT INTO " + tabName),
|
|
|
+ keySql = new StringBuilder(),
|
|
|
+ valSql = new StringBuilder();
|
|
|
+ if (id == null) {
|
|
|
+ if (dataMap2.containsKey("id")) {
|
|
|
+ id = dataMap2.get("id");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ keySql.append("id");
|
|
|
+ valSql.append(id == null ? SnowFlakeUtil.getId() : id);
|
|
|
+ if (groupId == null) {
|
|
|
+ groupId = dataMap2.get("group_id");
|
|
|
+ }
|
|
|
+ if (groupId != null) {
|
|
|
+ keySql.append(", group_id");
|
|
|
+ valSql.append(", ").append(groupId);
|
|
|
+ }
|
|
|
+ if (pKeyId == null) {
|
|
|
+ pKeyId = dataMap2.get("p_key_id");
|
|
|
+ }
|
|
|
+ if (pKeyId != null) {
|
|
|
+ keySql.append(", p_key_id");
|
|
|
+ valSql.append(", ").append(pKeyId);
|
|
|
+ }
|
|
|
+ //参数
|
|
|
+ Map<String, String> opsParamMap = new HashMap<>();
|
|
|
+ dataMap2.remove("id");
|
|
|
+ dataMap2.remove("group_id");
|
|
|
+ dataMap2.remove("p_key_id");
|
|
|
+ String fields = dataMap2.keySet().stream().map(key -> "'" + key + "'").collect(Collectors.joining(","));
|
|
|
+ Map<String, Integer> map = new HashMap<>();
|
|
|
+ if (!fields.isEmpty()) {
|
|
|
+ try {
|
|
|
+ fields = fields + ", 'key_201'";
|
|
|
+ List<Map<String, Object>> fieldMap = jdbcTemplate.queryForList("select distinct COLUMN_NAME as fieldName, CHARACTER_MAXIMUM_LENGTH as fieldLength from information_schema.COLUMNS where TABLE_NAME = '" + tabName +
|
|
|
+ "' and COLUMN_NAME in (" + fields + ")");
|
|
|
+ map = fieldMap.stream().collect(toMap(k -> k.get("fieldName") + "", v -> {
|
|
|
+ try {
|
|
|
+ return Integer.parseInt(v.get("fieldLength") + "");
|
|
|
+ } catch (Exception e) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }, Math::min));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String key : dataMap2.keySet()) {
|
|
|
+ String[] split = key.split("_");
|
|
|
+ if (split.length > 1 && Integer.parseInt(split[1]) > 80) {
|
|
|
+ // 大于80则保留在扩展字段中
|
|
|
+ opsParamMap.put(key, dataMap2.get(key));
|
|
|
+ } else {
|
|
|
+ String value = dataMap2.get(key);
|
|
|
+ if (value != null) {
|
|
|
+ Integer i = map.get(key);
|
|
|
+ // 长度超过数据库长度也保留在扩展字段中
|
|
|
+ if (i != null && value.length() > i) {
|
|
|
+ opsParamMap.put(key, dataMap2.get(key));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ keySql.append(", ").append(key);
|
|
|
+ valSql.append(", '").append(value).append("'");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!opsParamMap.isEmpty()) {
|
|
|
+ keySql.append(", key_201");
|
|
|
+ String data = DataStructureFormatUtils.buildData(opsParamMap);
|
|
|
+ try {
|
|
|
+ if (!map.containsKey( "key_201")) {
|
|
|
+ jdbcTemplate.execute("alter table " + tabName + " add column key_201 text");
|
|
|
+ } else {
|
|
|
+ Integer i = map.get("key_201");
|
|
|
+ if (data.length() > i) {
|
|
|
+ if (i < 10000) {
|
|
|
+ // 65535 byte
|
|
|
+ jdbcTemplate.execute("alter table " + tabName + " modify column key_201 text");
|
|
|
+ }else {
|
|
|
+ // 16777215 byte
|
|
|
+ jdbcTemplate.execute("alter table " + tabName + " modify column key_201 mediumtext");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ valSql.append(", '").append(data).append("'");
|
|
|
+ }
|
|
|
+ sql.append("(").append(keySql).append(")").append(" values(").append(valSql).append(")");
|
|
|
+ return sql;
|
|
|
+ }
|
|
|
|
|
|
// 获取用户
|
|
|
@Override
|
|
@@ -1690,6 +1831,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (dataIn != null && dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
// 时间段处理
|
|
@@ -1979,6 +2121,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (dataIn != null && dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
// 时间段处理
|
|
@@ -3070,6 +3213,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
reData1=new HashMap<>(reData);
|
|
|
if (dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
|
|
@@ -3351,6 +3495,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
|
|
@@ -3793,37 +3938,65 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 组装电签设置
|
|
|
+ Elements dqids = table.getElementsByAttribute("dqid");
|
|
|
+ // 电签组装2
|
|
|
+ String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + wbsTreePrivate.getInitTableName() + "' GROUP BY e_key";
|
|
|
|
|
|
- // 组装电签设置
|
|
|
- Elements dqids = table.getElementsByAttribute("dqid");
|
|
|
- for (Element element : dqids) {
|
|
|
- String dqid = element.attr("dqid");
|
|
|
- Elements x11 = element.getElementsByAttribute("x1");
|
|
|
- if (x11 != null && x11.size() >= 1) {
|
|
|
- Element element1 = x11.get(x11.size() - 1);
|
|
|
- int x1 = Func.toInt(element1.attr("x1"));
|
|
|
- int y1 = Func.toInt(element1.attr("y1"));
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
|
|
|
|
|
|
- Row row = sheet.getRow(y1 - 1);
|
|
|
- if (row != null) {
|
|
|
- Cell cell = row.getCell(x1 - 1);
|
|
|
- if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
- short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
- Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
|
- Font redFont = workbook.createFont();
|
|
|
- redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
|
|
|
- redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
|
|
|
- redFont.setFontName(oldfontAt.getFontName());//设置字体
|
|
|
- String CellValue = cell.getStringCellValue().trim();
|
|
|
+ if(mapList!=null && mapList.size()>0){
|
|
|
+ for(Map<String, Object> map : mapList) {
|
|
|
+ Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
|
|
|
+ if(elementsBy!=null && elementsBy.size()>0){
|
|
|
+ for(Element element : elementsBy){
|
|
|
+ String ids = (String) map.get("ids");
|
|
|
+ ids = ids.replace(",","");
|
|
|
+ ids = ids.substring(1);
|
|
|
+ element.attr("sign_type", ids);
|
|
|
+ dqids.add(element);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
|
|
|
- newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
- newStyle.setFont(redFont);
|
|
|
- newStyle.setShrinkToFit(true);
|
|
|
- cell.setCellStyle(newStyle);
|
|
|
- cell.setCellValue(dqid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Element element : dqids) {
|
|
|
+ String dqid="";
|
|
|
+ if(element.hasAttr("sign_type")){
|
|
|
+ dqid = element.attr("sign_type");
|
|
|
+ }else{
|
|
|
+ dqid = element.attr("dqid");
|
|
|
+ }
|
|
|
+ Elements x11 = element.getElementsByAttribute("x1");
|
|
|
+ if (x11 != null && x11.size() >= 1) {
|
|
|
+ Element element1 = x11.get(x11.size() - 1);
|
|
|
+ int x1 = Func.toInt(element1.attr("x1"));
|
|
|
+ int y1 = Func.toInt(element1.attr("y1"));
|
|
|
+
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
|
+ Font redFont = workbook.createFont();
|
|
|
+ redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
|
|
|
+ redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
|
|
|
+ redFont.setFontName(oldfontAt.getFontName());//设置字体
|
|
|
+ CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
|
|
|
+ newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+ newStyle.setFont(redFont);
|
|
|
+ newStyle.setShrinkToFit(true);
|
|
|
+ cell.setCellStyle(newStyle);
|
|
|
+ if (cell.getCellTypeEnum().equals(CellType.STRING)) {
|
|
|
+ String value = cell.getStringCellValue();
|
|
|
+ if (StringUtil.hasText(value) && !value.equals("/")) {
|
|
|
+ dqid = value + "*" + dqid;
|
|
|
}
|
|
|
}
|
|
|
+ cell.setCellValue(dqid);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4013,22 +4186,22 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//新增SQL
|
|
|
String sqlInfo = "";
|
|
|
LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
|
|
|
- updateFieldLength(wbsTreePrivate.getInitTableName() ,dataMap2);
|
|
|
if(!dataMap2.containsKey("p_key_id")){
|
|
|
if(tableInfo.getPkeyId()!=null&&!tableInfo.getPkeyId().equals("")){
|
|
|
dataMap2.put("p_key_id",tableInfo.getPkeyId());
|
|
|
}
|
|
|
}
|
|
|
- sqlInfo = "INSERT INTO " + wbsTreePrivate.getInitTableName() + " ( ";
|
|
|
- String keyStr = "id,group_id,";
|
|
|
- String valStr = SnowFlakeUtil.getId() + "," + groupId + ",";
|
|
|
- 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 + ")";
|
|
|
+ sqlInfo = buildMTableInsertSql(wbsTreePrivate.getInitTableName(), dataMap2, SnowFlakeUtil.getId(), groupId, tableInfo.getPkeyId()).toString();
|
|
|
+// sqlInfo = "INSERT INTO " + wbsTreePrivate.getInitTableName() + " ( ";
|
|
|
+// String keyStr = "id,group_id,";
|
|
|
+// String valStr = SnowFlakeUtil.getId() + "," + groupId + ",";
|
|
|
+// 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 + ")";
|
|
|
TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
|
|
|
try {
|
|
|
//删除
|
|
@@ -4987,56 +5160,89 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 组装电签设置
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.select("col_key", "id");
|
|
|
+ queryWrapper.in("type", 2, 6);
|
|
|
+ queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
+ List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + wbsTreePrivate.getInitTableName() + "' GROUP BY e_key";
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
|
|
|
+ if(!mapList.isEmpty()){
|
|
|
+ for(Map<String, Object> map : mapList) {
|
|
|
+ Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "__");
|
|
|
+ if(elementsBy!=null && !elementsBy.isEmpty()){
|
|
|
+ String ids = map.get("ids").toString();
|
|
|
+ ids = ids.replace(",","");
|
|
|
+ String[] split = ids.split("\\*✹");
|
|
|
+ for(Element element : elementsBy){
|
|
|
+ for (String s : split) {
|
|
|
+ if (s.isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ TextdictInfo info = new TextdictInfo();
|
|
|
+ info.setColKey(element.attr("keyname"));
|
|
|
+ info.setId(Long.parseLong(s));
|
|
|
+ info.setType(-1);
|
|
|
+ textdictInfos.add(info);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
+ for (TextdictInfo e : textdictInfos) {
|
|
|
+ String key = e.getColKey();
|
|
|
+ String[] keys = key.split("__");
|
|
|
+ String[] trtd = keys[1].split("_");
|
|
|
+ if (Integer.parseInt(trtd[0]) < trs.size()) {
|
|
|
+ Element ytzData = trs.get(Integer.parseInt(trtd[0]));
|
|
|
+ if (ytzData != null) {
|
|
|
+ Elements tdsx = ytzData.select("td");
|
|
|
+ if (Integer.parseInt(trtd[1]) < tdsx.size()) {
|
|
|
+ Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
|
|
|
+ if (data.html().contains("el-tooltip")) {
|
|
|
+ data = data.children().get(0);
|
|
|
+ }
|
|
|
|
|
|
- // 组装电签设置
|
|
|
- QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.select("col_key", "id");
|
|
|
- queryWrapper.in("type", 2, 6);
|
|
|
- queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
-
|
|
|
- List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
- if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
- for (TextdictInfo e : textdictInfos) {
|
|
|
- String key = e.getColKey();
|
|
|
- String[] keys = key.split("__");
|
|
|
- String[] trtd = keys[1].split("_");
|
|
|
- if (Integer.parseInt(trtd[0]) < trs.size()) {
|
|
|
- Element ytzData = trs.get(Integer.parseInt(trtd[0]));
|
|
|
- if (ytzData != null) {
|
|
|
- Elements tdsx = ytzData.select("td");
|
|
|
- if (Integer.parseInt(trtd[1]) < tdsx.size()) {
|
|
|
- Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
|
|
|
- if (data.html().contains("el-tooltip")) {
|
|
|
- data = data.children().get(0);
|
|
|
- }
|
|
|
-
|
|
|
- int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
- if (x1 == 0) {
|
|
|
- x1 = 1;
|
|
|
+ int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
+ }
|
|
|
+ int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
+
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
|
+ if (cell != null) {
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
|
+
|
|
|
+ Font redFont = workbook.createFont();
|
|
|
+ redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
|
|
|
+ redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
|
|
|
+ redFont.setFontName(oldfontAt.getFontName());//设置字体
|
|
|
+
|
|
|
+ CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
|
|
|
+ newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+ newStyle.setFont(redFont);
|
|
|
+ cell.setCellStyle(newStyle);
|
|
|
+ String id = e.getId() + "";
|
|
|
+ if (e.getType() != null && e.getType() == -1) {
|
|
|
+ id = "✹" + id;
|
|
|
}
|
|
|
- int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
-
|
|
|
- Row row = sheet.getRow(y1 - 1);
|
|
|
- if (row != null) {
|
|
|
- Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
|
- if (cell != null) {
|
|
|
- short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
- Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
|
-
|
|
|
- Font redFont = workbook.createFont();
|
|
|
- redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
|
|
|
- redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
|
|
|
- redFont.setFontName(oldfontAt.getFontName());//设置字体
|
|
|
-
|
|
|
- CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
|
|
|
- newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
- newStyle.setFont(redFont);
|
|
|
- cell.setCellStyle(newStyle);
|
|
|
- cell.setCellValue(e.getId() + "");
|
|
|
- } else {
|
|
|
- ObjectUtils.isNotEmpty(cell);
|
|
|
- }
|
|
|
+ if (cell.getCellTypeEnum() == CellType.STRING && StringUtil.hasText(cell.getStringCellValue())) {
|
|
|
+ id = cell.getStringCellValue() + "*" + id;
|
|
|
}
|
|
|
+ cell.setCellValue(id);
|
|
|
+ } else {
|
|
|
+ ObjectUtils.isNotEmpty(cell);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5281,6 +5487,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
// 时间段处理
|
|
@@ -5575,48 +5782,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Async("taskExecutor1")
|
|
|
- public void synchronizedPdf(List<TableInfo> tableInfoList, String nodeId, String classify, String contractId, String projectId) {
|
|
|
- try {
|
|
|
- List<String> errorPKeyIds = new ArrayList<>();
|
|
|
- //单个pdf加载
|
|
|
- if (tableInfoList != null) {
|
|
|
- tableInfoList.parallelStream().forEach(tableInfo -> {
|
|
|
- R bussPdfInfo = null;
|
|
|
- try {
|
|
|
- bussPdfInfo = this.getBussPdfInfo(Long.parseLong(tableInfo.getPkeyId()));
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (ObjectUtil.isEmpty(bussPdfInfo) || bussPdfInfo.getCode() != 200) {
|
|
|
- //如果返回的单张pdfUrl为空,那么表示发生异常,返回异常信息
|
|
|
- errorPKeyIds.add(tableInfo.getPkeyId());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //发生异常后直接返回,不进行合并
|
|
|
-// if (errorPKeyIds.size() > 0) {
|
|
|
-// List<AppWbsTreeContractVO> errorTabs = new LinkedList<>();
|
|
|
-// for (AppWbsTreeContractVO appWbsTreeContractVO : tableAll) {
|
|
|
-// if (errorPKeyIds.contains(appWbsTreeContractVO.getPKeyId().toString())) {
|
|
|
-// errorTabs.add(appWbsTreeContractVO);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (errorTabs.size() > 0) {
|
|
|
-// List<String> names = errorTabs.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList());
|
|
|
-// return R.fail("以下的表在生成pdf文件时发生了异常【" + StringUtils.join(names, "、") + "】");
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
- //合并pdf加载
|
|
|
- this.getBussPdfs(nodeId, classify, contractId, projectId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new ServiceException("问题");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public void cancelSample(Long groupId, Long pkeyId, Long contractId, Long sampleId1) throws Exception {
|
|
@@ -5705,6 +5870,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
if (dataIn.size() >= 1) {
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ DataStructureFormatUtils.parseDataByKey(mysqlData);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
// 时间段处理
|
|
@@ -5808,6 +5974,48 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
jdbcTemplate.update(sql);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Async("taskExecutor1")
|
|
|
+ public void synchronizedPdf(List<TableInfo> tableInfoList, String nodeId, String classify, String contractId, String projectId) {
|
|
|
+ try {
|
|
|
+ List<String> errorPKeyIds = new ArrayList<>();
|
|
|
+ //单个pdf加载
|
|
|
+ if (tableInfoList != null) {
|
|
|
+ tableInfoList.parallelStream().forEach(tableInfo -> {
|
|
|
+ R bussPdfInfo = null;
|
|
|
+ try {
|
|
|
+ bussPdfInfo = this.getBussPdfInfo(Long.parseLong(tableInfo.getPkeyId()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(bussPdfInfo) || bussPdfInfo.getCode() != 200) {
|
|
|
+ //如果返回的单张pdfUrl为空,那么表示发生异常,返回异常信息
|
|
|
+ errorPKeyIds.add(tableInfo.getPkeyId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //发生异常后直接返回,不进行合并
|
|
|
+// if (errorPKeyIds.size() > 0) {
|
|
|
+// List<AppWbsTreeContractVO> errorTabs = new LinkedList<>();
|
|
|
+// for (AppWbsTreeContractVO appWbsTreeContractVO : tableAll) {
|
|
|
+// if (errorPKeyIds.contains(appWbsTreeContractVO.getPKeyId().toString())) {
|
|
|
+// errorTabs.add(appWbsTreeContractVO);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (errorTabs.size() > 0) {
|
|
|
+// List<String> names = errorTabs.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList());
|
|
|
+// return R.fail("以下的表在生成pdf文件时发生了异常【" + StringUtils.join(names, "、") + "】");
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ //合并pdf加载
|
|
|
+ this.getBussPdfs(nodeId, classify, contractId, projectId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new ServiceException("问题");
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
public void synPdfKeyInfo(String nodeId, String classify, String contractId, String projectId) throws Exception {
|
|
|
// 获取有权限的节点信息
|