|
@@ -92,6 +92,7 @@ import java.net.URL;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -1055,7 +1056,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
public R getBussPdfInfo(Long pkeyId) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
//String file_path = "/Users/hongchuangyanfa/Desktop/";
|
|
|
-
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
|
|
@@ -1425,6 +1425,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
+ .select(WbsTreePrivate::getInitTableName, WbsTreePrivate::getHtmlUrl, WbsTreePrivate::getPKeyId)
|
|
|
.eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
if (wbsTreePrivate == null) {
|
|
|
return list;
|
|
@@ -1441,6 +1442,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ //实体数据
|
|
|
String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
|
|
|
List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
|
|
@@ -1457,6 +1459,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
+
|
|
|
// 时间段处理
|
|
|
if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
|
|
@@ -1516,6 +1519,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
// 获取默认值
|
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.select("col_key", "sig_role_name");
|
|
|
queryWrapper.eq("type", 4);
|
|
|
queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
final List<TextdictInfo> textDictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
@@ -1540,6 +1544,159 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 试验 获取填报信息 - 施工关联试验数据
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getBussDataInfoTrialRecordSG(Long groupId, Long pkeyId) {
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ Map<String, Object> reData = new HashMap<>();
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
+ .select(WbsTreePrivate::getInitTableName, WbsTreePrivate::getHtmlUrl, WbsTreePrivate::getPKeyId, WbsTreePrivate::getInitTableId)
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
+ if (wbsTreePrivate == null) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ if (wbsTreePrivate.getHtmlUrl() == null) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //表单是否存储在
|
|
|
+ String tabName = wbsTreePrivate.getInitTableName();
|
|
|
+ String isExitSql = "select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
+ List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
|
|
|
+ if (tabList.size() <= 0) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //实体数据
|
|
|
+ String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
|
|
|
+ List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
+
|
|
|
+ //对应实体表的对应Key字段的KeyName字段名
|
|
|
+ Map<String, WbsFormElement> elementMap = null;
|
|
|
+ if (StringUtils.isNotEmpty(wbsTreePrivate.getInitTableId())) {
|
|
|
+ String eleSql = "select e_key,e_name from m_wbs_form_element where f_id = " + wbsTreePrivate.getInitTableId();
|
|
|
+ elementMap = jdbcTemplate.query(eleSql, new BeanPropertyRowMapper<>(WbsFormElement.class)).stream().collect(Collectors.toMap(WbsFormElement::getEKey, Function.identity()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 匹配关联
|
|
|
+ try {
|
|
|
+ File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+ String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dataIn.size() >= 1) {
|
|
|
+ Map<String, Object> mysqlData = dataIn.get(0);
|
|
|
+ for (String key : mysqlData.keySet()) {
|
|
|
+ String tabVal = mysqlData.get(key) + "";
|
|
|
+
|
|
|
+ //映射KeyName名称
|
|
|
+ if (elementMap != null && elementMap.size() > 0) {
|
|
|
+ WbsFormElement wbsFormElement = elementMap.get(key);
|
|
|
+ if (wbsFormElement != null) {
|
|
|
+
|
|
|
+ key = wbsFormElement.getEName();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
+
|
|
|
+ //处理相同字段名称问题,同一个KeyName,那么拼接value
|
|
|
+ Object oldValue = reData.get(key);
|
|
|
+ if (oldValue != null) {
|
|
|
+ reData.put(key, oldValue + "、" + tabVal);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //时间段处理
|
|
|
+ if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+
|
|
|
+ if (reData.containsKey("pickerKey")) {
|
|
|
+ String pickerKey = reData.get("pickerKey") + "," + key;
|
|
|
+ reData.put("pickerKey", pickerKey);
|
|
|
+ } else {
|
|
|
+ reData.put("pickerKey", key);
|
|
|
+ }
|
|
|
+
|
|
|
+ String sql = tabData[0];
|
|
|
+ sql = sql.replaceAll("\\[", "['");
|
|
|
+ sql = sql.replaceAll("]", "']");
|
|
|
+ sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
+ sql = sql.replaceAll(", 20", ", '20");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key, sql);
|
|
|
+ }
|
|
|
+
|
|
|
+ //时间和字符串合作
|
|
|
+ } else if (tabVal.contains("T") && tabVal.contains(".000Z")) { //时间
|
|
|
+ if (tabVal.contains("☆")) {
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
+ for (String data : mysql) {
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key, tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key, tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (tabVal.contains("☆")) {
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
+ for (String data : mysql) {
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key, tabData[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (tabVal.contains("_^_")) {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ reData.put(key, tabData[0]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ reData.put(key, tabVal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取默认值
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.select("col_key", "sig_role_name");
|
|
|
+ queryWrapper.eq("type", 4);
|
|
|
+ queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
+ final List<TextdictInfo> textDictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (!textDictInfos.isEmpty()) {
|
|
|
+ for (TextdictInfo textdictInfo : textDictInfos) {
|
|
|
+ if (reData.containsKey(textdictInfo.getColKey())) {
|
|
|
+ String keyVal = reData.get(textdictInfo.getColKey()) + "";
|
|
|
+ } else {
|
|
|
+ reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 移除Id 和 p_key_id
|
|
|
+ reData.remove("id");
|
|
|
+ reData.remove("p_key_id");
|
|
|
+ reData.remove("classify");
|
|
|
+ reData.remove("contractId");
|
|
|
+ reData.remove("pkeyId");
|
|
|
+ reData.remove("projectId");
|
|
|
+ list.add(reData);
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 试验 单pdf
|
|
|
*/
|